Merge pull request #3046 from element-hq/robin/close-action-patch

Patch for v0.7: Send a 'close' action when the widget is ready to close
This commit is contained in:
Robin
2025-03-04 11:11:06 -05:00
committed by GitHub
2 changed files with 16 additions and 2 deletions

View File

@@ -135,7 +135,20 @@ const widgetPostHangupProcedure = async (
// We send the hangup event after the memberships have been updated
// calling leaveRTCSession.
// We need to wait because this makes the client hosting this widget killing the IFrame.
await widget.api.transport.send(ElementWidgetActions.HangupCall, {});
try {
await widget.api.transport.send(ElementWidgetActions.HangupCall, {});
} catch (e) {
logger.error("Failed to send hangup action", e);
}
// To make the hangup procedure behave more similarly to what future versions
// of Element Call will do, we additionally send a close action (even though
// we're not yet employing the distinction between 'hangup' and 'close' to
// display error screens)
try {
await widget.api.transport.send(ElementWidgetActions.Close, {});
} catch (e) {
logger.error("Failed to send close action", e);
}
};
export async function leaveRTCSession(

View File

@@ -17,10 +17,11 @@ import { getUrlParams } from "./UrlParams";
import { Config } from "./config/Config";
import { ElementCallReactionEventType } from "./reactions";
// Subset of the actions in matrix-react-sdk
// Subset of the actions in element-web
export enum ElementWidgetActions {
JoinCall = "io.element.join",
HangupCall = "im.vector.hangup",
Close = "io.element.close",
TileLayout = "io.element.tile_layout",
SpotlightLayout = "io.element.spotlight_layout",
// This can be sent as from or to widget