improve chat

This commit is contained in:
Peter Maquiran
2022-01-11 16:07:54 +01:00
parent dcee5aa2f4
commit ab2198a412
5 changed files with 37 additions and 65 deletions
+6 -58
View File
@@ -136,7 +136,9 @@ export class ChatPage implements OnInit {
this.modalController.dismiss();
}
};
this.showLoader = true;
this.load()
}
ngOnInit() {
@@ -144,45 +146,6 @@ export class ChatPage implements OnInit {
console.log(this.loggedUserChat);
this.segment = "Contactos";
// this.authService.userData$.subscribe((res: any) => {
// this.loggedUser = res;
// console.log(this.loggedUser);
// this.load();
// // this.getDirectMessagesDB();
// });
/* websocket functions */
//this.sendMsg();
/* Fim websocket functions */
// this.hideRefreshButton();
// this.getChatMembers();
//Teste
// let t = this.showDateDuration(new Date());
// console.log(t);
// this.setStatus('away');
/* if(this.dataService.get("newGroup")){
this.openNewGroupPage();
} */
// this.router.events.forEach((event) => {
// if (event instanceof NavigationStart && event.url.startsWith('/home/chat')) {
// if (this.dataService.get("newGroup")) {
// this.openNewGroupPage();
// }
// else{
// this.closeAllDesktopComponents();
// this.showEmptyComponent = true;
// }
// }
// else{
// this.dataService.set("newGroup", false);
// }
// });
}
numSequence(n: number): Array<number> {
@@ -224,21 +187,6 @@ export class ChatPage implements OnInit {
}
}
/* loadMessage(){
this.chatService.messages.subscribe(msg => {
console.log("Response from websocket: " + msg);
});
} */
/* sendMsg() {
console.log("new message from client to websocket: ", this.message);
this.chatService.messages.next(this.message);
this.message.msg = "";
} */
/* Fim websockets functions */
closeAllDesktopComponents() {
this.showMessages = false;
this.showContacts = false;
@@ -570,7 +518,7 @@ export class ChatPage implements OnInit {
//Check if modal is opened
if (this.segment == "Contactos" && this.showMessages != true) {
await new Promise(resolve => setTimeout(resolve, 1000));
await this.getDirectMessages();
//await this.getDirectMessages();
//console.log('Timer contactos list running')
}
else {
@@ -579,7 +527,7 @@ export class ChatPage implements OnInit {
}
}
else {
await this.getDirectMessages();
//await this.getDirectMessages();
}
});
}
@@ -734,12 +682,12 @@ export class ChatPage implements OnInit {
//Check if modal is opened
if (this.segment == "Grupos" && this.showGroupMessages != true) {
await new Promise(resolve => setTimeout(resolve, 1000));
await this.getGroups();
//await this.getGroups();
}
}
}
else {
await this.getGroups();
//await this.getGroups();
}
});
}