improve chat

This commit is contained in:
Peter Maquiran
2023-01-09 10:49:58 +01:00
parent 56c1733945
commit a73dde467c
21 changed files with 436 additions and 373 deletions
+20 -8
View File
@@ -395,21 +395,27 @@ export class ChatService {
if(this.NetworkServiceService.getCurrentNetworkStatus() == ConnectionStatus.Offline) {
this.RochetChatConnectorService.registerCallback({
requestId: 'refreshtoken',
type: 'reConnect',
funx: async ()=> {
funx: async () => {
this.resetTimer();
await this.refreshtoken();
return true
}
})
} else {
this.resetTimer();
await this.refreshtoken();
setTimeout(async () => {
this.resetTimer();
await this.refreshtoken();
}, 60000)
}
}
} else if(!SessionStore.user.ChatData) {
// do nothing
} else if (!this.headers) {
@@ -437,7 +443,6 @@ export class ChatService {
}
functionTimer = null;
timerEventTriggerDate = null
timerEventTriggerDateLastUpdate = null
@@ -447,8 +452,15 @@ export class ChatService {
this.timerEventTriggerDate = new Date(+new Date() + 60000*15);
this.functionTimer = setTimeout(() => {
this.refreshtoken();
}, 60000 * 5); // time is in milliseconds
if(this.NetworkServiceService.getCurrentNetworkStatus() == ConnectionStatus.Online) {
this.refreshtoken();
} else {
this.resetTimer()
}
}, 60000 * 15); // time is in milliseconds
}
}