change(tracker): fix confirmation window crash
This commit is contained in:
parent
2920066335
commit
140c9ea948
4 changed files with 30 additions and 21 deletions
|
|
@ -26,10 +26,13 @@ export interface Options {
|
|||
callConfirm: ConfirmOptions,
|
||||
controlConfirm: ConfirmOptions,
|
||||
|
||||
confirmText?: string, // @depricated
|
||||
confirmStyle?: Properties, // @depricated
|
||||
// @depricated
|
||||
confirmText?: string,
|
||||
// @depricated
|
||||
confirmStyle?: Properties,
|
||||
|
||||
config: RTCConfiguration,
|
||||
callUITemplate?: string,
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -151,7 +154,7 @@ export default class Assist {
|
|||
this.options,
|
||||
id => {
|
||||
if (!callUI) {
|
||||
callUI = new CallWindow(app.debug.error)
|
||||
callUI = new CallWindow(app.debug.error, this.options.callUITemplate)
|
||||
}
|
||||
callUI?.showRemoteControl(remoteControl.releaseControl)
|
||||
this.agents[id].onControlReleased = this.options.onRemoteControlStart()
|
||||
|
|
@ -161,10 +164,12 @@ export default class Assist {
|
|||
return callingAgents.get(id)
|
||||
},
|
||||
id => {
|
||||
const cb = this.agents[id].onControlReleased
|
||||
delete this.agents[id].onControlReleased
|
||||
typeof cb === 'function' && cb()
|
||||
this.emit('control_rejected', id)
|
||||
if (id) {
|
||||
const cb = this.agents[id].onControlReleased
|
||||
delete this.agents[id].onControlReleased
|
||||
typeof cb === 'function' && cb()
|
||||
this.emit('control_rejected', id)
|
||||
}
|
||||
if (annot != null) {
|
||||
annot.remove()
|
||||
annot = null
|
||||
|
|
@ -373,7 +378,7 @@ export default class Assist {
|
|||
|
||||
// UI
|
||||
if (!callUI) {
|
||||
callUI = new CallWindow(app.debug.error)
|
||||
callUI = new CallWindow(app.debug.error, this.options.callUITemplate)
|
||||
}
|
||||
callUI.showControls(initiateCallEnd)
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export default class CallWindow {
|
|||
|
||||
private readonly load: Promise<void>
|
||||
|
||||
constructor(private readonly logError: (...args: any[]) => void) {
|
||||
constructor(private readonly logError: (...args: any[]) => void, private readonly callUITemplate?: string) {
|
||||
const iframe = (this.iframe = document.createElement('iframe'))
|
||||
Object.assign(iframe.style, {
|
||||
position: 'fixed',
|
||||
|
|
@ -45,8 +45,8 @@ export default class CallWindow {
|
|||
}
|
||||
|
||||
//const baseHref = "https://static.openreplay.com/tracker-assist/test"
|
||||
const baseHref = 'https://static.openreplay.com/tracker-assist/4.0.0'
|
||||
this.load = fetch(baseHref + '/index.html')
|
||||
const baseHref = 'https://static.openreplay.com/tracker-assist/4.0.0/index.html'
|
||||
this.load = fetch(this.callUITemplate || baseHref)
|
||||
.then((r) => r.text())
|
||||
.then((text) => {
|
||||
iframe.onload = () => {
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ export default class ConfirmWindow {
|
|||
wrapper.appendChild(popup)
|
||||
|
||||
wrapper.setAttribute('data-openreplay-hidden', '')
|
||||
|
||||
this.wrapper = wrapper
|
||||
|
||||
confirmBtn.onclick = () => {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export default class RemoteControl {
|
|||
constructor(
|
||||
private readonly options: AssistOptions,
|
||||
private readonly onGrand: (id: string) => string | undefined,
|
||||
private readonly onRelease: (id: string) => void) {}
|
||||
private readonly onRelease: (id?: string | null) => void) {}
|
||||
|
||||
reconnect(ids: string[]) {
|
||||
const storedID = sessionStorage.getItem(this.options.session_control_peer_key)
|
||||
|
|
@ -67,6 +67,18 @@ export default class RemoteControl {
|
|||
})
|
||||
}
|
||||
|
||||
releaseControl = () => {
|
||||
if (this.confirm) {
|
||||
this.confirm.remove()
|
||||
this.confirm = null
|
||||
}
|
||||
this.resetMouse()
|
||||
this.status = RCStatus.Disabled
|
||||
sessionStorage.removeItem(this.options.session_control_peer_key)
|
||||
this.onRelease(this.agentID)
|
||||
this.agentID = null
|
||||
}
|
||||
|
||||
grantControl = (id: string) => {
|
||||
this.agentID = id
|
||||
this.status = RCStatus.Enabled
|
||||
|
|
@ -79,15 +91,6 @@ export default class RemoteControl {
|
|||
this.mouse.mount()
|
||||
}
|
||||
|
||||
releaseControl = () => {
|
||||
if (!this.agentID) { return }
|
||||
this.resetMouse()
|
||||
this.status = RCStatus.Disabled
|
||||
sessionStorage.removeItem(this.options.session_control_peer_key)
|
||||
this.onRelease(this.agentID)
|
||||
this.agentID = null
|
||||
}
|
||||
|
||||
resetMouse = () => {
|
||||
this.mouse?.remove()
|
||||
this.mouse = null
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue