Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 0d1bb3b

Browse files
authored
Show a dialog when Jitsi encounters an error (#8701)
* Show a dialog when Jitsi encounters an error * Capitalize 'Meet' * Revise copy to not mention Jitsi
1 parent 655bca6 commit 0d1bb3b

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

src/i18n/strings/en_EN.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,8 @@
831831
"The person who invited you has already left.": "The person who invited you has already left.",
832832
"The person who invited you has already left, or their server is offline.": "The person who invited you has already left, or their server is offline.",
833833
"Failed to join": "Failed to join",
834+
"Connection lost": "Connection lost",
835+
"You were disconnected from the call. (Error: %(message)s)": "You were disconnected from the call. (Error: %(message)s)",
834836
"All rooms": "All rooms",
835837
"Home": "Home",
836838
"Favourites": "Favourites",

src/stores/widgets/ElementWidgetActions.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ export enum ElementWidgetActions {
3636
ViewRoom = "io.element.view_room",
3737
}
3838

39+
export interface IHangupCallApiRequest extends IWidgetApiRequest {
40+
data: {
41+
errorMessage?: string;
42+
};
43+
}
44+
3945
/**
4046
* @deprecated Use MSC2931 instead
4147
*/

src/stores/widgets/StopGapWidget.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import { MatrixEvent, MatrixEventEvent } from "matrix-js-sdk/src/models/event";
3737
import { logger } from "matrix-js-sdk/src/logger";
3838
import { ClientEvent } from "matrix-js-sdk/src/client";
3939

40+
import { _t } from "../../languageHandler";
4041
import { StopGapWidgetDriver } from "./StopGapWidgetDriver";
4142
import { WidgetMessagingStore } from "./WidgetMessagingStore";
4243
import { RoomViewStore } from "../RoomViewStore";
@@ -50,7 +51,7 @@ import ActiveWidgetStore from "../ActiveWidgetStore";
5051
import { objectShallowClone } from "../../utils/objects";
5152
import defaultDispatcher from "../../dispatcher/dispatcher";
5253
import { Action } from "../../dispatcher/actions";
53-
import { ElementWidgetActions, IViewRoomApiRequest } from "./ElementWidgetActions";
54+
import { ElementWidgetActions, IHangupCallApiRequest, IViewRoomApiRequest } from "./ElementWidgetActions";
5455
import { ModalWidgetStore } from "../ModalWidgetStore";
5556
import ThemeWatcher from "../../settings/watchers/ThemeWatcher";
5657
import { getCustomTheme } from "../../theme";
@@ -60,6 +61,8 @@ import { getUserLanguage } from "../../languageHandler";
6061
import { WidgetVariableCustomisations } from "../../customisations/WidgetVariables";
6162
import { arrayFastClone } from "../../utils/arrays";
6263
import { ViewRoomPayload } from "../../dispatcher/payloads/ViewRoomPayload";
64+
import Modal from "../../Modal";
65+
import ErrorDialog from "../../components/views/dialogs/ErrorDialog";
6366

6467
// TODO: Destroy all of this code
6568

@@ -367,6 +370,21 @@ export class StopGapWidget extends EventEmitter {
367370
},
368371
);
369372
}
373+
374+
if (WidgetType.JITSI.matches(this.mockWidget.type)) {
375+
this.messaging.on(`action:${ElementWidgetActions.HangupCall}`,
376+
(ev: CustomEvent<IHangupCallApiRequest>) => {
377+
if (ev.detail.data?.errorMessage) {
378+
Modal.createTrackedDialog("Connection lost", "", ErrorDialog, {
379+
title: _t("Connection lost"),
380+
description: _t("You were disconnected from the call. (Error: %(message)s)", {
381+
message: ev.detail.data.errorMessage,
382+
}),
383+
});
384+
}
385+
},
386+
);
387+
}
370388
}
371389

372390
public async prepare(): Promise<void> {

0 commit comments

Comments
 (0)