Merge pull request #3689 from toger5/toger5/remove-deprecated-layout-widget-actions
Remove deprecated widget layout actions
This commit is contained in:
@@ -33,7 +33,6 @@ import { useTranslation } from "react-i18next";
|
|||||||
|
|
||||||
import LogoMark from "../icons/LogoMark.svg?react";
|
import LogoMark from "../icons/LogoMark.svg?react";
|
||||||
import LogoType from "../icons/LogoType.svg?react";
|
import LogoType from "../icons/LogoType.svg?react";
|
||||||
import type { IWidgetApiRequest } from "matrix-widget-api";
|
|
||||||
import {
|
import {
|
||||||
EndCallButton,
|
EndCallButton,
|
||||||
MicButton,
|
MicButton,
|
||||||
@@ -45,7 +44,7 @@ import {
|
|||||||
import { Header, LeftNav, RightNav, RoomHeaderInfo } from "../Header";
|
import { Header, LeftNav, RightNav, RoomHeaderInfo } from "../Header";
|
||||||
import { type HeaderStyle, useUrlParams } from "../UrlParams";
|
import { type HeaderStyle, useUrlParams } from "../UrlParams";
|
||||||
import { useCallViewKeyboardShortcuts } from "../useCallViewKeyboardShortcuts";
|
import { useCallViewKeyboardShortcuts } from "../useCallViewKeyboardShortcuts";
|
||||||
import { ElementWidgetActions, widget } from "../widget";
|
import { widget } from "../widget";
|
||||||
import styles from "./InCallView.module.css";
|
import styles from "./InCallView.module.css";
|
||||||
import { GridTile } from "../tile/GridTile";
|
import { GridTile } from "../tile/GridTile";
|
||||||
import { SettingsModal, defaultSettingsTab } from "../settings/SettingsModal";
|
import { SettingsModal, defaultSettingsTab } from "../settings/SettingsModal";
|
||||||
@@ -435,46 +434,6 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
[vm],
|
[vm],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
widget?.api.transport
|
|
||||||
.send(
|
|
||||||
gridMode === "grid"
|
|
||||||
? ElementWidgetActions.TileLayout
|
|
||||||
: ElementWidgetActions.SpotlightLayout,
|
|
||||||
{},
|
|
||||||
)
|
|
||||||
.catch((e) => {
|
|
||||||
logger.error("Failed to send layout change to widget API", e);
|
|
||||||
});
|
|
||||||
}, [gridMode]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (widget) {
|
|
||||||
const onTileLayout = (ev: CustomEvent<IWidgetApiRequest>): void => {
|
|
||||||
setGridMode("grid");
|
|
||||||
widget!.api.transport.reply(ev.detail, {});
|
|
||||||
};
|
|
||||||
const onSpotlightLayout = (ev: CustomEvent<IWidgetApiRequest>): void => {
|
|
||||||
setGridMode("spotlight");
|
|
||||||
widget!.api.transport.reply(ev.detail, {});
|
|
||||||
};
|
|
||||||
|
|
||||||
widget.lazyActions.on(ElementWidgetActions.TileLayout, onTileLayout);
|
|
||||||
widget.lazyActions.on(
|
|
||||||
ElementWidgetActions.SpotlightLayout,
|
|
||||||
onSpotlightLayout,
|
|
||||||
);
|
|
||||||
|
|
||||||
return (): void => {
|
|
||||||
widget!.lazyActions.off(ElementWidgetActions.TileLayout, onTileLayout);
|
|
||||||
widget!.lazyActions.off(
|
|
||||||
ElementWidgetActions.SpotlightLayout,
|
|
||||||
onSpotlightLayout,
|
|
||||||
);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}, [setGridMode]);
|
|
||||||
|
|
||||||
useAppBarSecondaryButton(
|
useAppBarSecondaryButton(
|
||||||
useMemo(() => {
|
useMemo(() => {
|
||||||
if (audioOutputSwitcher === null) return null;
|
if (audioOutputSwitcher === null) return null;
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ export enum ElementWidgetActions {
|
|||||||
JoinCall = "io.element.join",
|
JoinCall = "io.element.join",
|
||||||
HangupCall = "im.vector.hangup",
|
HangupCall = "im.vector.hangup",
|
||||||
Close = "io.element.close",
|
Close = "io.element.close",
|
||||||
TileLayout = "io.element.tile_layout",
|
|
||||||
SpotlightLayout = "io.element.spotlight_layout",
|
|
||||||
// This can be sent as from or to widget
|
// This can be sent as from or to widget
|
||||||
// fromWidget: updates the client about the current device mute state
|
// fromWidget: updates the client about the current device mute state
|
||||||
// toWidget: the client requests a specific device mute configuration
|
// toWidget: the client requests a specific device mute configuration
|
||||||
@@ -83,8 +81,6 @@ export const widget = ((): WidgetHelpers | null => {
|
|||||||
WidgetApiToWidgetAction.ThemeChange,
|
WidgetApiToWidgetAction.ThemeChange,
|
||||||
ElementWidgetActions.JoinCall,
|
ElementWidgetActions.JoinCall,
|
||||||
ElementWidgetActions.HangupCall,
|
ElementWidgetActions.HangupCall,
|
||||||
ElementWidgetActions.TileLayout,
|
|
||||||
ElementWidgetActions.SpotlightLayout,
|
|
||||||
ElementWidgetActions.DeviceMute,
|
ElementWidgetActions.DeviceMute,
|
||||||
].forEach((action) => {
|
].forEach((action) => {
|
||||||
api.on(`action:${action}`, (ev: CustomEvent<IWidgetApiRequest>) => {
|
api.on(`action:${action}`, (ev: CustomEvent<IWidgetApiRequest>) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user