From 8548e1d49ea0ce5c412c4f21a97f8745108472b5 Mon Sep 17 00:00:00 2001 From: sylenien Date: Fri, 16 Sep 2022 18:18:54 +0200 Subject: [PATCH] change(tracker): move end call cb --- tracker/tracker-assist/src/Assist.ts | 3 +-- tracker/tracker-assist/src/CallWindow.ts | 15 ++++----------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/tracker/tracker-assist/src/Assist.ts b/tracker/tracker-assist/src/Assist.ts index 4b2c35208..54971156e 100644 --- a/tracker/tracker-assist/src/Assist.ts +++ b/tracker/tracker-assist/src/Assist.ts @@ -377,8 +377,7 @@ export default class Assist { if (!callUI) { callUI = new CallWindow(app.debug.error) } - callUI.setCallEndAction(initiateCallEnd) - callUI.showControls() + callUI.showControls(initiateCallEnd) if (!annot) { annot = new AnnotationCanvas() diff --git a/tracker/tracker-assist/src/CallWindow.ts b/tracker/tracker-assist/src/CallWindow.ts index 1640940a0..cae8ef1cc 100644 --- a/tracker/tracker-assist/src/CallWindow.ts +++ b/tracker/tracker-assist/src/CallWindow.ts @@ -122,16 +122,6 @@ export default class CallWindow { this.iframe.style.width = `${doc.body.scrollWidth}px` } - setCallEndAction(endCall: () => void) { - this.load - .then(() => { - if (this.endCallBtn) { - this.endCallBtn.onclick = endCall - } - }) - .catch((e) => this.logError(e)) - } - private checkRemoteVideoInterval: ReturnType private audioContainer: HTMLDivElement | null = null addRemoteStream(rStream: MediaStream) { @@ -280,12 +270,15 @@ export default class CallWindow { .catch((e) => this.logError(e)) } - public showControls() { + public showControls(endCall: () => void) { this.load .then(() => { if (this.controlsContainer) { this.controlsContainer.style.display = 'unset' } + if (this.endCallBtn) { + this.endCallBtn.onclick = endCall + } this.adjustIframeSize() }) .catch((e) => this.logError(e))