Fix Jitsi widget not staying on screen correctly

The "Join Conference" screen should not be sticky. We also need to make sure we have a widget ID set so that when we say to be stuck on screen or not, the request actually passes.
This commit is contained in:
Travis Ralston 2019-03-15 20:31:07 -06:00
parent 43473f7d4d
commit 34653eb223
3 changed files with 16 additions and 1 deletions

View File

@ -66,6 +66,7 @@ export class ScalarWidgetApi {
public static sendSetAlwaysOnScreen(alwaysVisible: boolean): void { public static sendSetAlwaysOnScreen(alwaysVisible: boolean): void {
ScalarWidgetApi.callAction("set_always_on_screen", { ScalarWidgetApi.callAction("set_always_on_screen", {
// Send the value here and in data due to a Riot bug.
data: { data: {
value: alwaysVisible, value: alwaysVisible,
}, },
@ -92,6 +93,7 @@ export class ScalarWidgetApi {
request["action"] = action; request["action"] = action;
request["requestId"] = randomString({length: 160}); request["requestId"] = randomString({length: 160});
console.log("[Dimension] Sending fromWidget: ", request);
window.opener.postMessage(request, "*"); window.opener.postMessage(request, "*");
} }
@ -102,6 +104,8 @@ export class ScalarWidgetApi {
let requestClone = JSON.parse(JSON.stringify(request)); let requestClone = JSON.parse(JSON.stringify(request));
requestClone["response"] = payload; requestClone["response"] = payload;
console.log("[Dimension] Sending postMessage response: ", request);
window.opener.postMessage(requestClone, "*"); window.opener.postMessage(requestClone, "*");
} }
} }

View File

@ -31,6 +31,6 @@ export abstract class CapableWidget implements OnInit, OnDestroy {
} }
protected onCapabilitiesSent(): void { protected onCapabilitiesSent(): void {
if (this.supportsAlwaysOnScreen) ScalarWidgetApi.sendSetAlwaysOnScreen(true); // Nothing to do here.
} }
} }

View File

@ -37,6 +37,9 @@ export class JitsiWidgetWrapperComponent extends CapableWidget implements OnInit
this.displayName = params.displayName; this.displayName = params.displayName;
this.avatarUrl = params.avatarUrl; this.avatarUrl = params.avatarUrl;
this.userId = params.userId || params.email; // Riot uses `email` when placing a conference call this.userId = params.userId || params.email; // Riot uses `email` when placing a conference call
// Set the widget ID if we have it
ScalarWidgetApi.widgetId = params.widgetId;
} }
public ngOnInit() { public ngOnInit() {
@ -88,6 +91,8 @@ export class JitsiWidgetWrapperComponent extends CapableWidget implements OnInit
$(".join-conference-wrapper").hide(); $(".join-conference-wrapper").hide();
$("#jitsiContainer").show(); $("#jitsiContainer").show();
ScalarWidgetApi.sendSetAlwaysOnScreen(true);
this.jitsiApiObj = new JitsiMeetExternalAPI(this.domain, { this.jitsiApiObj = new JitsiMeetExternalAPI(this.domain, {
width: "100%", width: "100%",
height: "100%", height: "100%",
@ -106,6 +111,7 @@ export class JitsiWidgetWrapperComponent extends CapableWidget implements OnInit
this.jitsiApiObj.on("readyToClose", () => { this.jitsiApiObj.on("readyToClose", () => {
this.isJoined = false; this.isJoined = false;
ScalarWidgetApi.sendSetAlwaysOnScreen(false);
$(".join-conference-wrapper").show(); $(".join-conference-wrapper").show();
$("#jitsiContainer").hide().html(""); $("#jitsiContainer").hide().html("");
}); });
@ -117,4 +123,9 @@ export class JitsiWidgetWrapperComponent extends CapableWidget implements OnInit
if (this.jitsiApiSubscription) this.jitsiApiSubscription.unsubscribe(); if (this.jitsiApiSubscription) this.jitsiApiSubscription.unsubscribe();
} }
protected onCapabilitiesSent(): void {
super.onCapabilitiesSent();
ScalarWidgetApi.sendSetAlwaysOnScreen(false);
}
} }