implemented

- get groups contacts
-get messages contacts
-order group conversation list to most recent
-send message in group.
This commit is contained in:
tiago.kayaya
2021-01-19 16:10:40 +01:00
parent b90247b566
commit 3043d519e5
8 changed files with 163 additions and 38 deletions
+24 -14
View File
@@ -72,17 +72,7 @@ export class ChatPage implements OnInit {
this.getGroups();
}, 2000);
}
getGroups(){
this.showLoader = true;
this.result = this.chatService.getAllPrivateGroups().subscribe((res:any)=>{
this.privateGroups = res.groups;
this.result = this.chatService.getAllUserChannels().subscribe((res:any)=>{
this.publicGroups = res.channels;
this.allGroups = this.privateGroups.concat(this.publicGroups);
this.showLoader = false;
});
});
}
getDirectMessages(){
this.showLoader = true;
@@ -93,7 +83,7 @@ export class ChatPage implements OnInit {
this.userDirectMessages = res.ims.sort((a,b)=>{
var dateA = new Date(a.lastMessage._updatedAt).getTime();
var dateB = new Date(b.lastMessage._updatedAt).getTime();
return dateB - dateB;
return dateB - dateA;
});
console.log(this.userDirectMessages);
@@ -107,6 +97,24 @@ export class ChatPage implements OnInit {
console.log(this.dmUsers); */
});
}
getGroups(){
this.showLoader = true;
this.result = this.chatService.getAllPrivateGroups().subscribe((res:any)=>{
this.privateGroups = res.groups;
this.result = this.chatService.getAllUserChannels().subscribe((res:any)=>{
this.publicGroups = res.channels;
let all = this.privateGroups.concat(this.publicGroups);
this.allGroups = all.sort((a,b)=>{
var dateA = new Date(a.lastMessage._updatedAt).getTime();
var dateB = new Date(b.lastMessage._updatedAt).getTime();
return dateB - dateA;
});
console.log(this.allGroups);
this.showLoader = false;
});
});
}
/* getConnectedChannels(){
this.showLoader = true;
@@ -183,13 +191,15 @@ export class ChatPage implements OnInit {
await modal.present();
modal.onDidDismiss();
}
async openGroupMessages(user:any){
async openGroupMessages(room:any){
console.log(room);
const modal = await this.modalController.create({
component: GroupMessagesPage,
cssClass: 'group-messages',
backdropDismiss: false,
componentProps: {
user: user,
room: room,
},
});
await modal.present();