Handle ManagedHybrid widgets in useRoomCall and mark them in the widget state event

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2023-09-11 11:39:30 +01:00
parent 5a2595a093
commit 569832bc24
No known key found for this signature in database
GPG key ID: A2B008A5F49F5D0D
4 changed files with 21 additions and 8 deletions

View file

@ -22,7 +22,7 @@ import { getCallBehaviourWellKnown } from "../utils/WellKnownUtils";
import WidgetUtils from "../utils/WidgetUtils";
import { IStoredLayout, WidgetLayoutStore } from "../stores/widgets/WidgetLayoutStore";
import WidgetEchoStore from "../stores/WidgetEchoStore";
import WidgetStore from "../stores/WidgetStore";
import WidgetStore, { IApp } from "../stores/WidgetStore";
import SdkConfig from "../SdkConfig";
import DMRoomMap from "../utils/DMRoomMap";
@ -97,7 +97,10 @@ export async function addManagedHybridWidget(roomId: string): Promise<void> {
// Add the widget
try {
await WidgetUtils.setRoomWidgetContent(cli, roomId, widgetId, widgetContent);
await WidgetUtils.setRoomWidgetContent(cli, roomId, widgetId, {
...widgetContent,
"io.element.managed_hybrid": true,
});
} catch (e) {
logger.error(`Unable to add managed hybrid widget in room ${roomId}`, e);
return;
@ -116,3 +119,7 @@ export async function addManagedHybridWidget(roomId: string): Promise<void> {
WidgetLayoutStore.instance.setContainerHeight(room, layout.container, layout.height);
WidgetLayoutStore.instance.copyLayoutToRoom(room);
}
export function isManagedHybridWidget(widget: IApp): boolean {
return !!widget["io.element.managed_hybrid"];
}