mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
improve chat
This commit is contained in:
@@ -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
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user