Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07e1506dd8 |
@@ -34,6 +34,7 @@ describe("LotusWidgetActions", () => {
|
|||||||
LotusWidgetActions.SetHotkeys,
|
LotusWidgetActions.SetHotkeys,
|
||||||
LotusWidgetActions.SetFrameScreenshare,
|
LotusWidgetActions.SetFrameScreenshare,
|
||||||
LotusWidgetActions.PromptScreenshare,
|
LotusWidgetActions.PromptScreenshare,
|
||||||
|
LotusWidgetActions.Reconnect,
|
||||||
];
|
];
|
||||||
|
|
||||||
expect(new Set(LOTUS_TO_WIDGET_ACTIONS)).toEqual(new Set(expectedToWidget));
|
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.MicLevel);
|
||||||
expect(LOTUS_TO_WIDGET_ACTIONS).not.toContain(LotusWidgetActions.Hotkey);
|
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.
|
* only when it changes (≤ 10 Hz); 0 while muted or with no mic.
|
||||||
*/
|
*/
|
||||||
MicLevel = "io.lotus.mic_level",
|
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`. */
|
/** toWidget Lotus actions that must be allow-listed in `initializeWidget`. */
|
||||||
@@ -133,4 +141,5 @@ export const LOTUS_TO_WIDGET_ACTIONS: LotusWidgetActions[] = [
|
|||||||
LotusWidgetActions.SetHotkeys,
|
LotusWidgetActions.SetHotkeys,
|
||||||
LotusWidgetActions.SetFrameScreenshare,
|
LotusWidgetActions.SetFrameScreenshare,
|
||||||
LotusWidgetActions.PromptScreenshare,
|
LotusWidgetActions.PromptScreenshare,
|
||||||
|
LotusWidgetActions.Reconnect,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
type ReactNode,
|
type ReactNode,
|
||||||
type SVGAttributes,
|
type SVGAttributes,
|
||||||
useCallback,
|
useCallback,
|
||||||
|
useEffect,
|
||||||
} from "react";
|
} from "react";
|
||||||
import { Trans, useTranslation } from "react-i18next";
|
import { Trans, useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
@@ -24,6 +25,7 @@ import {
|
|||||||
import { Button } from "@vector-im/compound-web";
|
import { Button } from "@vector-im/compound-web";
|
||||||
import { logger } from "matrix-js-sdk/lib/logger";
|
import { logger } from "matrix-js-sdk/lib/logger";
|
||||||
import { MatrixError } from "matrix-js-sdk";
|
import { MatrixError } from "matrix-js-sdk";
|
||||||
|
import { type IWidgetApiRequest } from "matrix-widget-api";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ConnectionLostError,
|
ConnectionLostError,
|
||||||
@@ -38,6 +40,7 @@ import { FullScreenView } from "../FullScreenView.tsx";
|
|||||||
import { ErrorView } from "../ErrorView.tsx";
|
import { ErrorView } from "../ErrorView.tsx";
|
||||||
import { type WidgetHelpers } from "../widget.ts";
|
import { type WidgetHelpers } from "../widget.ts";
|
||||||
import styles from "../ErrorView.module.css";
|
import styles from "../ErrorView.module.css";
|
||||||
|
import { LotusWidgetActions, lotusSendToHost } from "../lotus/lotusWidget";
|
||||||
|
|
||||||
export type CallErrorRecoveryAction = "reconnect"; // | "retry" ;
|
export type CallErrorRecoveryAction = "reconnect"; // | "retry" ;
|
||||||
|
|
||||||
@@ -74,6 +77,29 @@ const ErrorPage: FC<ErrorPageProps> = ({
|
|||||||
icon = ErrorSolidIcon;
|
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 }[] = [];
|
const actions: { label: string; onClick: () => void }[] = [];
|
||||||
if (error instanceof ConnectionLostError) {
|
if (error instanceof ConnectionLostError) {
|
||||||
actions.push({
|
actions.push({
|
||||||
|
|||||||
Reference in New Issue
Block a user