From 1ee3268d906c080ee8d4b6f87127a7b0cdbbc54a Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 15 Jan 2024 11:28:21 +0100 Subject: [PATCH] Return to lobby after call ended in widget mode Signed-off-by: Timo K --- src/room/GroupCallView.tsx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/room/GroupCallView.tsx b/src/room/GroupCallView.tsx index 2073dd20..d1dc6257 100644 --- a/src/room/GroupCallView.tsx +++ b/src/room/GroupCallView.tsx @@ -137,9 +137,6 @@ export const GroupCallView: FC = ({ }, [perParticipantE2EE, e2eeSharedKey]); useEffect(() => { - // this effect is only if we don't want to show the lobby (skipLobby = true) - if (!skipLobby) return; - const defaultDeviceSetup = async ( requestedDeviceData: JoinCallData, ): Promise => { @@ -189,8 +186,9 @@ export const GroupCallView: FC = ({ } } }; - if (widget && preload) { - // In preload mode, wait for a join action before entering + + if (widget && preload && skipLobby) { + // In preload mode without lobby we wait for a join action before entering const onJoin = async ( ev: CustomEvent, ): Promise => { @@ -205,10 +203,15 @@ export const GroupCallView: FC = ({ return () => { widget!.lazyActions.off(ElementWidgetActions.JoinCall, onJoin); }; - } else { - // if we don't use preload and only skipLobby we enter the rtc session right away + } else if (widget && !preload && skipLobby) { + // No lobby and no preload: we enter the rtc session right away + widget.api.setAlwaysOnScreen(true); defaultDeviceSetup({ audioInput: null, videoInput: null }); enterRTCSession(rtcSession, perParticipantE2EE); + } else if (widget && !skipLobby) { + // If we show the lobby, we still need to set the widget to sticky + // joining will be triggered by the lobby view. + widget!.api.setAlwaysOnScreen(true); } }, [rtcSession, preload, skipLobby, perParticipantE2EE]); @@ -338,7 +341,7 @@ export const GroupCallView: FC = ({ /> ); - } else if (left) { + } else if (left && widget === null) { // The call ended view is shown for two reasons: prompting guests to create // an account, and prompting users that have opted into analytics to provide // feedback. We don't show a feedback prompt to widget users however (at @@ -366,7 +369,7 @@ export const GroupCallView: FC = ({ // LobbyView again which would open capture devices again. return null; } - } else if (preload) { + } else if (preload || skipLobby) { return null; } else { return (