This commit is contained in:
Peter Maquiran
2023-09-19 10:21:23 +01:00
parent 527cc0f2a6
commit f51bd246fc
29 changed files with 754 additions and 261 deletions
@@ -36,7 +36,7 @@ export class GroupContactsPage implements OnInit {
objectUserSingleStone = []
userContainer = {}
constructor(
private modalController: ModalController,
private http: HttpClient,
@@ -61,8 +61,8 @@ export class GroupContactsPage implements OnInit {
// this.chatService.refreshtoken();
this.loadUsers();
// this.getMembers();
}
loadUsers(){
@@ -98,10 +98,10 @@ export class GroupContactsPage implements OnInit {
} else {
'not found'
}
}
const userContainer = {}
for(const user of this.objectUserSingleStone) {
const firstLetter = user.name.charAt(0)
@@ -111,11 +111,11 @@ export class GroupContactsPage implements OnInit {
} else {
userContainer[firstLetter].push(user)
}
}
this.userContainer = userContainer
this.showLoader = false;
});
@@ -155,16 +155,16 @@ export class GroupContactsPage implements OnInit {
"roomId": this.room._id,
"userId": data._id,
}
if(this.room.t == "p"){
this.chatService.removeGroupMember(body).subscribe(res=>{
this.getMembers();
});
}
else if(this.room.t == "c"){
this.chatService.removeChannelMember(body).subscribe(res=>{
this.getMembers();
});
}
@@ -195,7 +195,7 @@ export class GroupContactsPage implements OnInit {
});
const selectedUsers = this.users.filter( e => e?.isChecked == true)
users.forEach( (user, index) => {
if(user[index]) {
console.log({user, index})
@@ -215,7 +215,7 @@ export class GroupContactsPage implements OnInit {
let a = this.objectUserSingleStone.filter( e => e.name.toLowerCase().includes(this.textSearch.toLowerCase()))
let b = {}
for(const user of a) {
const firstLetter = user.name.charAt(0)
@@ -225,16 +225,16 @@ export class GroupContactsPage implements OnInit {
} else {
b[firstLetter].push(user)
}
}
this.userContainer = b
}
clicked(){
}
selectedContact(user:any) {
@@ -244,18 +244,18 @@ export class GroupContactsPage implements OnInit {
} else {
user.isChecked = true
}
const userIndex = this.objectUserSingleStone.findIndex((e) => e._id == user._id)
this.objectUserSingleStone[userIndex].isChecked = user.isChecked
}
addContacts(room:any){
this.selectedUserList = this.users.filter(function(contact) {
return contact.isChecked == true;
});
this.selectedUserList.forEach(user=>{
let body ={
"roomId":room._id,
@@ -263,7 +263,7 @@ export class GroupContactsPage implements OnInit {
}
this.chatService.addUserToGroup(body).subscribe(res=>{
});
});
}
@@ -271,12 +271,12 @@ export class GroupContactsPage implements OnInit {
loading = false
updateGroup(){
if(this.loading) {
return
return
}
this.loading = true
console.log('this.room', this.room)
this.chatService.getRoomInfo(this.room._id).subscribe(room=>{
this.room = room['room'];
this.addContacts(this.room);
@@ -288,8 +288,8 @@ export class GroupContactsPage implements OnInit {
}
async openGroupMessages(roomId:any){
this.close();
const modal = await this.modalController.create({
component: GroupMessagesPage,
componentProps: {
@@ -300,9 +300,11 @@ export class GroupContactsPage implements OnInit {
});
modal.onDidDismiss();
modal.onDidDismiss().then(() => {
this.close();
});
await modal.present();
}
}