* Avoid destroying calls until they are hidden from the UI We often want calls to exist even when no more participants are left in the MatrixRTC session. So, we should avoid destroying calls as long as they're being presented in the UI; this means that the user has an intent to either join the call or continue looking at an error screen, and we shouldn't interrupt that interaction. The RoomViewStore is now what takes care of creating and destroying calls, rather than the CallView. In general it seems kinda impossible to safely create and destroy model objects from React lifecycle hooks, so moving this responsibility to a store seemed appropriate and resolves existing issues with calls in React strict mode. * Wait for a close action before closing a call This creates a distinction between the user hanging up and the widget being ready to close, which is useful for allowing Element Call to show error screens when disconnected from the call, for example. * Don't expect a 'close' action in video rooms These use the returnToLobby option and are expected to remain visible when the user leaves the call.
62 lines
2.1 KiB
TypeScript
62 lines
2.1 KiB
TypeScript
/*
|
|
* Copyright 2024 New Vector Ltd.
|
|
* Copyright 2020-2022 The Matrix.org Foundation C.I.C.
|
|
*
|
|
* SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
|
* Please see LICENSE files in the repository root for full details.
|
|
*/
|
|
|
|
import { type IWidgetApiRequest } from "matrix-widget-api";
|
|
|
|
export enum ElementWidgetActions {
|
|
// All of these actions are currently specific to Jitsi and Element Call
|
|
JoinCall = "io.element.join",
|
|
HangupCall = "im.vector.hangup",
|
|
Close = "io.element.close",
|
|
CallParticipants = "io.element.participants",
|
|
StartLiveStream = "im.vector.start_live_stream",
|
|
|
|
// Actions for switching layouts
|
|
TileLayout = "io.element.tile_layout",
|
|
SpotlightLayout = "io.element.spotlight_layout",
|
|
|
|
OpenIntegrationManager = "integration_manager_open",
|
|
/**
|
|
* @deprecated Use MSC2931 instead
|
|
*/
|
|
ViewRoom = "io.element.view_room",
|
|
|
|
// This action type is used as a `fromWidget` and a `toWidget` action.
|
|
// fromWidget: updates the client about the current device mute state
|
|
// toWidget: the client requests a specific device mute configuration
|
|
// The reply will always be the resulting configuration
|
|
// It is possible to sent an empty configuration to retrieve the current values or
|
|
// just one of the fields to update that particular value
|
|
// An undefined field means that EC will keep the mute state as is.
|
|
// -> this will allow the client to only get the current state
|
|
//
|
|
// The data of the widget action request and the response are:
|
|
// {
|
|
// audio_enabled?: boolean,
|
|
// video_enabled?: boolean
|
|
// }
|
|
// NOTE: this is currently unused. Its only here to make EW aware
|
|
// of this action so it does not throw errors.
|
|
DeviceMute = "io.element.device_mute",
|
|
}
|
|
|
|
export interface IHangupCallApiRequest extends IWidgetApiRequest {
|
|
data: {
|
|
errorMessage?: string;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* @deprecated Use MSC2931 instead
|
|
*/
|
|
export interface IViewRoomApiRequest extends IWidgetApiRequest {
|
|
data: {
|
|
room_id: string; // eslint-disable-line camelcase
|
|
};
|
|
}
|