fix(tracker): some fixes for assist

This commit is contained in:
nick-delirium 2023-10-04 10:39:11 +02:00
parent 8216f0108f
commit 5b9d63cb55
2 changed files with 27 additions and 22 deletions

View file

@ -1,3 +1,7 @@
## 6.0.1
- few small fixes for reconnects
## 6.0.0
- added support for multi tab assist session

View file

@ -279,16 +279,18 @@ export default class Assist {
onDisconnect: this.options.onAgentConnect?.(info),
agentInfo: info, // TODO ?
}
this.assistDemandedRestart = true
this.app.stop()
setTimeout(() => {
this.app.start().then(() => { this.assistDemandedRestart = false })
.then(() => {
if (this.app.active()) {
this.assistDemandedRestart = true
this.app.stop()
setTimeout(() => {
this.app.start().then(() => { this.assistDemandedRestart = false })
.then(() => {
this.remoteControl?.reconnect([id,])
})
.catch(e => app.debug.error(e))
// TODO: check if it's needed; basically allowing some time for the app to finish everything before starting again
}, 500)
})
.catch(e => app.debug.error(e))
// TODO: check if it's needed; basically allowing some time for the app to finish everything before starting again
}, 400)
}
})
socket.on('AGENTS_CONNECTED', (ids: string[]) => {
ids.forEach(id =>{
@ -298,17 +300,18 @@ export default class Assist {
onDisconnect: this.options.onAgentConnect?.(agentInfo),
}
})
this.assistDemandedRestart = true
this.app.stop()
setTimeout(() => {
this.app.start().then(() => { this.assistDemandedRestart = false })
.then(() => {
this.remoteControl?.reconnect(ids)
})
.catch(e => app.debug.error(e))
// TODO: check if it's needed; basically allowing some time for the app to finish everything before starting again
}, 500)
if (this.app.active()) {
this.assistDemandedRestart = true
this.app.stop()
setTimeout(() => {
this.app.start().then(() => { this.assistDemandedRestart = false })
.then(() => {
this.remoteControl?.reconnect(ids)
})
.catch(e => app.debug.error(e))
// TODO: check if it's needed; basically allowing some time for the app to finish everything before starting again
}, 400)
}
})
socket.on('AGENT_DISCONNECTED', (id) => {
@ -488,8 +491,6 @@ export default class Assist {
return
}
// UI
console.log(callUI)
if (!callUI) {
callUI = new CallWindow(console.log, this.options.callUITemplate)
callUI.setVideoToggleCallback(updateVideoFeed)