Fix not hanging up when using the close button (EXA EXI) (#1840)

---------

Signed-off-by: Timo K <toger5@hotmail.de>
This commit is contained in:
Timo
2023-10-30 17:30:30 +01:00
committed by GitHub
parent 5f98d69557
commit 441ad5bf2c
3 changed files with 21 additions and 15 deletions

View File

@@ -218,17 +218,6 @@ export const GroupCallView: FC<Props> = ({
);
await leaveRTCSession(rtcSession);
if (widget) {
// we need to wait until the callEnded event is tracked on posthog.
// Otherwise the iFrame gets killed before the callEnded event got tracked.
await new Promise((resolve) => window.setTimeout(resolve, 10)); // 10ms
widget.api.setAlwaysOnScreen(false);
PosthogAnalytics.instance.logout();
// we will always send the hangup event after the memberships have been updated
// calling leaveRTCSession.
widget.api.transport.send(ElementWidgetActions.HangupCall, {});
}
if (
!isPasswordlessUser &&
@@ -246,9 +235,8 @@ export const GroupCallView: FC<Props> = ({
const onHangup = async (
ev: CustomEvent<IWidgetApiRequest>,
): Promise<void> => {
leaveRTCSession(rtcSession);
widget!.api.transport.reply(ev.detail, {});
widget!.api.setAlwaysOnScreen(false);
await leaveRTCSession(rtcSession);
};
widget.lazyActions.once(ElementWidgetActions.HangupCall, onHangup);
return () => {