Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07e1506dd8 | ||
|
|
58625c86b0 | ||
|
|
e3ac9a96d6 |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@lotusguild/element-call-embedded",
|
||||
"version": "0.25.0-lotus.23",
|
||||
"version": "0.25.0-lotus.24",
|
||||
"files": [
|
||||
"README.md",
|
||||
"LICENSE-AGPL-3.0",
|
||||
|
||||
@@ -34,6 +34,7 @@ describe("LotusWidgetActions", () => {
|
||||
LotusWidgetActions.SetHotkeys,
|
||||
LotusWidgetActions.SetFrameScreenshare,
|
||||
LotusWidgetActions.PromptScreenshare,
|
||||
LotusWidgetActions.Reconnect,
|
||||
];
|
||||
|
||||
expect(new Set(LOTUS_TO_WIDGET_ACTIONS)).toEqual(new Set(expectedToWidget));
|
||||
@@ -56,5 +57,6 @@ describe("LotusWidgetActions", () => {
|
||||
);
|
||||
expect(LOTUS_TO_WIDGET_ACTIONS).not.toContain(LotusWidgetActions.MicLevel);
|
||||
expect(LOTUS_TO_WIDGET_ACTIONS).not.toContain(LotusWidgetActions.Hotkey);
|
||||
expect(LOTUS_TO_WIDGET_ACTIONS).not.toContain(LotusWidgetActions.CallError);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -116,6 +116,14 @@ export enum LotusWidgetActions {
|
||||
* only when it changes (≤ 10 Hz); 0 while muted or with no mic.
|
||||
*/
|
||||
MicLevel = "io.lotus.mic_level",
|
||||
/**
|
||||
* fromWidget: the call's error page is up (`{ code, recoverable }`) or
|
||||
* cleared (`{ code: null }`) (cinny #318), so the host stops showing the call
|
||||
* as joined after "Connection lost".
|
||||
*/
|
||||
CallError = "io.lotus.call_error",
|
||||
/** toWidget: press the error page's Reconnect / Try again (cinny #318). */
|
||||
Reconnect = "io.lotus.reconnect",
|
||||
}
|
||||
|
||||
/** toWidget Lotus actions that must be allow-listed in `initializeWidget`. */
|
||||
@@ -133,4 +141,5 @@ export const LOTUS_TO_WIDGET_ACTIONS: LotusWidgetActions[] = [
|
||||
LotusWidgetActions.SetHotkeys,
|
||||
LotusWidgetActions.SetFrameScreenshare,
|
||||
LotusWidgetActions.PromptScreenshare,
|
||||
LotusWidgetActions.Reconnect,
|
||||
];
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
type ReactNode,
|
||||
type SVGAttributes,
|
||||
useCallback,
|
||||
useEffect,
|
||||
} from "react";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import {
|
||||
@@ -24,6 +25,7 @@ import {
|
||||
import { Button } from "@vector-im/compound-web";
|
||||
import { logger } from "matrix-js-sdk/lib/logger";
|
||||
import { MatrixError } from "matrix-js-sdk";
|
||||
import { type IWidgetApiRequest } from "matrix-widget-api";
|
||||
|
||||
import {
|
||||
ConnectionLostError,
|
||||
@@ -38,6 +40,7 @@ import { FullScreenView } from "../FullScreenView.tsx";
|
||||
import { ErrorView } from "../ErrorView.tsx";
|
||||
import { type WidgetHelpers } from "../widget.ts";
|
||||
import styles from "../ErrorView.module.css";
|
||||
import { LotusWidgetActions, lotusSendToHost } from "../lotus/lotusWidget";
|
||||
|
||||
export type CallErrorRecoveryAction = "reconnect"; // | "retry" ;
|
||||
|
||||
@@ -74,6 +77,29 @@ const ErrorPage: FC<ErrorPageProps> = ({
|
||||
icon = ErrorSolidIcon;
|
||||
}
|
||||
|
||||
// [cinny #318] Tell the host the call dropped (it kept showing the call as
|
||||
// joined), and let its call bar press Reconnect for us.
|
||||
const recoverable =
|
||||
error instanceof ConnectionLostError ||
|
||||
error instanceof LivekitConnectionError ||
|
||||
error instanceof PeerConnectionTimeoutError;
|
||||
useEffect(() => {
|
||||
lotusSendToHost(LotusWidgetActions.CallError, {
|
||||
code: error.code,
|
||||
recoverable,
|
||||
});
|
||||
const w = widget;
|
||||
const onReconnect = (ev: CustomEvent<IWidgetApiRequest>): void => {
|
||||
w?.api.transport.reply(ev.detail, {});
|
||||
if (recoverable) void recoveryActionHandler("reconnect");
|
||||
};
|
||||
w?.lazyActions?.on(LotusWidgetActions.Reconnect, onReconnect);
|
||||
return (): void => {
|
||||
w?.lazyActions?.off(LotusWidgetActions.Reconnect, onReconnect);
|
||||
lotusSendToHost(LotusWidgetActions.CallError, { code: null });
|
||||
};
|
||||
}, [error.code, recoverable, recoveryActionHandler, widget]);
|
||||
|
||||
const actions: { label: string; onClick: () => void }[] = [];
|
||||
if (error instanceof ConnectionLostError) {
|
||||
actions.push({
|
||||
|
||||
Reference in New Issue
Block a user