This commit is contained in:
tiago.kayaya
2022-01-14 11:53:14 +01:00
parent c4b6abe094
commit a8e2b48c33
5 changed files with 8 additions and 142 deletions
@@ -110,7 +110,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
this.loggedUser=this.loggedUserChat;
this.getRoomInfo();
this.serverLongPull();
this.setStatus('online');
this.getChatMembers();
}
@@ -755,47 +754,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
});
}
async serverLongPull(){
if(this.route.url != "/home/chat" && document.querySelector('app-group-messages')){
console.log("Timer message stop")
}
else
{
this.chatService.getPrivateGroupMessages(this.roomId).subscribe(async res =>
{
if(res['success'] == true) {
// Show Error
//showMessage(response.statusText);
//this.loadMessages()
let msgOnly = res['messages'].filter(data => data.t != 'au');
this.messages = msgOnly.reverse();
console.log(this.messages);
// Reconnect in one second
if(document.querySelector('app-group-messages')){
await new Promise(resolve => setTimeout(resolve,5000));
this.getGroups.emit();
console.log('Timer message running')
await this.serverLongPull();
}
}
else {
alert('HEY2')
// Got message
//let message = await response.text();
//this.loadMessages()
await this.serverLongPull();
}
}, (error)=>{
console.log(error);
this.serverLongPull();
});
}
}
sliderOpts = {
zoom: false,