Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for v0.7: Send a 'close' action when the widget is ready to close #3046

Merged
merged 1 commit into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/rtcSessionHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion src/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down