mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-12-05 03:37:41 +00:00
Allow disabling legacy calls and make Voice & Video settings Legacy Voice & Video (#33692)
* Change `feature_group_calls` to default to true. Change state to Beta * Add `enableLegacyCallsVoip` (clarify: Audio settings relate to Legacy) Change `element_call.use_exclusively` to just be the default of `enableLegacyCallsVoip`. Allow disabling in Legacy in the settings. (overwrite `use_exclusivly` via `enableLegacyCallsVoip`) Rename `Voice & Video` to `Legacy Voice & Video` * improvements - settings title update to only show legacy when appropriate - hide menu all together if use_exclusivly is chosen * simplify by removing the feature_group_calls flag * smaller cleanup * fix tests and cleanup * clarify settings (disable) in config.md * add back EC relevant settings in room settings dialog * update screenshots (now default to EC enabled (not disabled) -> show voice and video tab in room settings * update screenshots * always show option to control voice messages input * lint * fix test * disable -> enabled And only have on mic dropdown * update config.md * Back to `disabled` (on by default/no config) * remove element call hint from voice-video settings * Update apps/web/src/i18n/strings/en_EN.json Co-authored-by: Robin <robin@robin.town> * Update apps/web/src/components/views/settings/tabs/user/VoiceUserSettingsTab.tsx Co-authored-by: Robin <robin@robin.town> * review * cleanup element call url setting (its deprecated/not used anymore) * clarify, that also jisti will be enabled/disabled by legacy settings flag * remove double section * remove unn exassary element_call configurations * Update en_EN.json * Update VoiceUserSettingsTab.tsx * Make tests use new defaults (enable element call) * Default events power levels * format * review "Enable Legacy voice/video calls" label * more radical usage of defaults in element_call config.json's * Update config.json * Update en_EN.json * Update RoomSettingsDialog-test.tsx.snap * Update useRoomCall.tsx * fix imports * Update request permission promp to latest designs: https://www.figma.com/design/aOEkaJtaBmPy058V7uoqVr/Element-Call-Updates---2026?node-id=45-12591&t=7takL39icZwt9YjL-0 * Update config.json.d.ts * fix usage of `Element` in i18n * Update General-room-settings-tab-should-be-rendered-properly-1-linux.png --------- Co-authored-by: Robin <robin@robin.town>
This commit is contained in:
@@ -45,6 +45,7 @@ import { PeopleRoomSettingsTab } from "../settings/tabs/room/PeopleRoomSettingsT
|
||||
import { SDKContext } from "../../../contexts/SDKContext";
|
||||
import { type SDKContextClass } from "../../../contexts/SDKContextClass";
|
||||
import { RoomSettingsTab } from "./RoomSettingsDialog-tab.ts";
|
||||
import SdkConfig from "../../../SdkConfig";
|
||||
|
||||
interface IProps {
|
||||
roomId: string;
|
||||
@@ -147,7 +148,7 @@ class RoomSettingsDialog extends React.Component<IProps, IState> {
|
||||
),
|
||||
);
|
||||
}
|
||||
if (SettingsStore.getValue("feature_group_calls")) {
|
||||
if (!SdkConfig.get("element_call").disable) {
|
||||
tabs.push(
|
||||
new Tab(
|
||||
RoomSettingsTab.Voip,
|
||||
|
||||
@@ -18,7 +18,6 @@ import Modal from "../../../../../Modal";
|
||||
import ErrorDialog from "../../../dialogs/ErrorDialog";
|
||||
import PowerSelector from "../../../elements/PowerSelector";
|
||||
import SettingsFieldset from "../../SettingsFieldset";
|
||||
import SettingsStore from "../../../../../settings/SettingsStore";
|
||||
import SdkConfig, { DEFAULTS } from "../../../../../SdkConfig";
|
||||
import { AddPrivilegedUsers } from "../../AddPrivilegedUsers";
|
||||
import SettingsTab from "../SettingsTab";
|
||||
@@ -270,17 +269,14 @@ export default class RolesRoomSettingsTab extends React.Component<IProps, RolesR
|
||||
[EventType.Reaction]: _td("room_settings|permissions|m.reaction"),
|
||||
[EventType.RoomRedaction]: _td("room_settings|permissions|m.room.redaction"),
|
||||
[EventType.RoomPinnedEvents]: _td("room_settings|permissions|m.room.pinned_events"),
|
||||
|
||||
// TODO: Enable support for m.widget event type (https://github.com/vector-im/element-web/issues/13111)
|
||||
"im.vector.modular.widgets": isSpaceRoom ? null : _td("room_settings|permissions|m.widget"),
|
||||
};
|
||||
|
||||
// MSC3401: Native Group VoIP signaling
|
||||
if (SettingsStore.getValue("feature_group_calls")) {
|
||||
if (!SdkConfig.get("element_call").disable) {
|
||||
plEventsToLabels[ElementCallEventType.name] = _td("room_settings|permissions|m.call");
|
||||
plEventsToLabels[ElementCallMemberEventType.name] = _td("room_settings|permissions|m.call.member");
|
||||
}
|
||||
|
||||
const powerLevelDescriptors: Record<string, IPowerLevelDescriptor> = {
|
||||
"users_default": {
|
||||
desc: _t("room_settings|permissions|users_default"),
|
||||
|
||||
@@ -11,7 +11,7 @@ import React, { type ChangeEventHandler, type JSX, type ReactNode } from "react"
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { FALLBACK_ICE_SERVER } from "matrix-js-sdk/src/webrtc/call";
|
||||
import { type EmptyObject } from "matrix-js-sdk/src/matrix";
|
||||
import { Form, SettingsToggleInput } from "@vector-im/compound-web";
|
||||
import { Alert, Form, SettingsToggleInput } from "@vector-im/compound-web";
|
||||
|
||||
import { _t } from "../../../../../languageHandler";
|
||||
import MediaDeviceHandler, { type IMediaDevices, MediaDeviceKindEnum } from "../../../../../MediaDeviceHandler";
|
||||
@@ -19,11 +19,13 @@ import Field from "../../../elements/Field";
|
||||
import AccessibleButton from "../../../elements/AccessibleButton";
|
||||
import { SettingLevel } from "../../../../../settings/SettingLevel";
|
||||
import SettingsFlag from "../../../elements/SettingsFlag";
|
||||
import SettingsStore from "../../../../../settings/SettingsStore";
|
||||
import { requestMediaPermissions } from "../../../../../utils/media/requestMediaPermissions";
|
||||
import SettingsTab from "../SettingsTab";
|
||||
import { SettingsSection } from "../../shared/SettingsSection";
|
||||
import { SettingsSubsection } from "../../shared/SettingsSubsection";
|
||||
import MatrixClientContext from "../../../../../contexts/MatrixClientContext";
|
||||
import SdkConfig from "../../../../../SdkConfig";
|
||||
|
||||
interface IState {
|
||||
mediaDevices: IMediaDevices | null;
|
||||
@@ -33,6 +35,7 @@ interface IState {
|
||||
audioAutoGainControl: boolean;
|
||||
audioEchoCancellation: boolean;
|
||||
audioNoiseSuppression: boolean;
|
||||
enableLegacyCallsVoip: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,16 +68,29 @@ export default class VoiceUserSettingsTab extends React.Component<EmptyObject, I
|
||||
audioAutoGainControl: MediaDeviceHandler.getAudioAutoGainControl(),
|
||||
audioEchoCancellation: MediaDeviceHandler.getAudioEchoCancellation(),
|
||||
audioNoiseSuppression: MediaDeviceHandler.getAudioNoiseSuppression(),
|
||||
enableLegacyCallsVoip: SettingsStore.getValue("enableLegacyCallsVoip"),
|
||||
};
|
||||
}
|
||||
|
||||
private legacyCallsEnabledWatcherRef: string | undefined;
|
||||
|
||||
public async componentDidMount(): Promise<void> {
|
||||
this.legacyCallsEnabledWatcherRef = SettingsStore.watchSetting(
|
||||
"enableLegacyCallsVoip",
|
||||
null,
|
||||
(...[, , , , value]) => this.setState({ enableLegacyCallsVoip: value as boolean }),
|
||||
);
|
||||
|
||||
const canSeeDeviceLabels = await MediaDeviceHandler.hasAnyLabeledDevices();
|
||||
if (canSeeDeviceLabels) {
|
||||
await this.refreshMediaDevices();
|
||||
}
|
||||
}
|
||||
|
||||
public componentWillUnmount(): void {
|
||||
SettingsStore.unwatchSetting(this.legacyCallsEnabledWatcherRef);
|
||||
}
|
||||
|
||||
private refreshMediaDevices = async (stream?: MediaStream): Promise<void> => {
|
||||
this.setState({
|
||||
mediaDevices: (await MediaDeviceHandler.getDevices()) ?? null,
|
||||
@@ -143,34 +159,46 @@ export default class VoiceUserSettingsTab extends React.Component<EmptyObject, I
|
||||
private onAutoGainChanged: ChangeEventHandler<HTMLInputElement> = async (event) => {
|
||||
const enable = event.target.checked;
|
||||
await MediaDeviceHandler.setAudioAutoGainControl(enable);
|
||||
this.setState({ audioAutoGainControl: MediaDeviceHandler.getAudioAutoGainControl() });
|
||||
this.setState({
|
||||
audioAutoGainControl: MediaDeviceHandler.getAudioAutoGainControl(),
|
||||
});
|
||||
};
|
||||
|
||||
private onNoiseSuppressionChanged: ChangeEventHandler<HTMLInputElement> = async (event) => {
|
||||
const enable = event.target.checked;
|
||||
await MediaDeviceHandler.setAudioNoiseSuppression(enable);
|
||||
this.setState({ audioNoiseSuppression: MediaDeviceHandler.getAudioNoiseSuppression() });
|
||||
this.setState({
|
||||
audioNoiseSuppression: MediaDeviceHandler.getAudioNoiseSuppression(),
|
||||
});
|
||||
};
|
||||
|
||||
private onEchoCancellationChanged: ChangeEventHandler<HTMLInputElement> = async (event) => {
|
||||
const enable = event.target.checked;
|
||||
await MediaDeviceHandler.setAudioEchoCancellation(enable);
|
||||
this.setState({ audioEchoCancellation: MediaDeviceHandler.getAudioEchoCancellation() });
|
||||
this.setState({
|
||||
audioEchoCancellation: MediaDeviceHandler.getAudioEchoCancellation(),
|
||||
});
|
||||
};
|
||||
|
||||
public render(): ReactNode {
|
||||
public render(): JSX.Element {
|
||||
let requestButton: ReactNode | undefined;
|
||||
let speakerDropdown: ReactNode | undefined;
|
||||
let microphoneDropdown: ReactNode | undefined;
|
||||
|
||||
let webcamDropdown: ReactNode | undefined;
|
||||
if (!this.state.mediaDevices) {
|
||||
requestButton = (
|
||||
<div>
|
||||
<p>{_t("settings|voip|missing_permissions_prompt")}</p>
|
||||
<AccessibleButton onClick={this.requestMediaPermissions} kind="primary">
|
||||
{_t("settings|voip|request_permissions")}
|
||||
</AccessibleButton>
|
||||
</div>
|
||||
<Alert
|
||||
type="info"
|
||||
title={_t("settings|voip|permissions")}
|
||||
actions={
|
||||
<AccessibleButton onClick={this.requestMediaPermissions} kind="primary">
|
||||
{_t("settings|voip|request_permissions")}
|
||||
</AccessibleButton>
|
||||
}
|
||||
>
|
||||
{_t("settings|voip|missing_permissions_prompt", { brand: SdkConfig.get("brand") })}
|
||||
</Alert>
|
||||
);
|
||||
} else if (this.state.mediaDevices) {
|
||||
speakerDropdown = this.renderDropdown(
|
||||
@@ -185,6 +213,44 @@ export default class VoiceUserSettingsTab extends React.Component<EmptyObject, I
|
||||
);
|
||||
}
|
||||
|
||||
const elementCallEnabled = !SdkConfig.get("element_call").disable;
|
||||
// We also allow/use legacy if element call is not enabled.
|
||||
const allowLegacyCalls = !SdkConfig.get("element_call").use_exclusively || !elementCallEnabled;
|
||||
const showLegacySettings = this.state.enableLegacyCallsVoip;
|
||||
|
||||
const legacySettingsComponent = (
|
||||
<>
|
||||
<SettingsSubsection heading={_t("settings|voip|voice_section")} stretchContent>
|
||||
{speakerDropdown}
|
||||
<SettingsToggleInput
|
||||
name="voice-auto-gain"
|
||||
label={_t("settings|voip|voice_agc")}
|
||||
checked={this.state.audioAutoGainControl}
|
||||
onChange={this.onAutoGainChanged}
|
||||
/>
|
||||
</SettingsSubsection>
|
||||
<SettingsSubsection heading={_t("settings|voip|video_section")} stretchContent>
|
||||
{webcamDropdown}
|
||||
<SettingsFlag name="VideoView.flipVideoHorizontally" level={SettingLevel.ACCOUNT} />
|
||||
</SettingsSubsection>
|
||||
<SettingsSection heading={_t("common|advanced")}>
|
||||
<SettingsFlag
|
||||
name="webRtcAllowPeerToPeer"
|
||||
level={SettingLevel.DEVICE}
|
||||
onChange={this.changeWebRtcMethod}
|
||||
/>
|
||||
<SettingsFlag
|
||||
name="fallbackICEServerAllowed"
|
||||
label={_t("settings|voip|enable_fallback_ice_server", {
|
||||
server: new URL(FALLBACK_ICE_SERVER).pathname,
|
||||
})}
|
||||
level={SettingLevel.DEVICE}
|
||||
hideIfCannotSet
|
||||
/>
|
||||
</SettingsSection>
|
||||
</>
|
||||
);
|
||||
|
||||
return (
|
||||
<SettingsTab>
|
||||
<Form.Root
|
||||
@@ -193,26 +259,22 @@ export default class VoiceUserSettingsTab extends React.Component<EmptyObject, I
|
||||
evt.stopPropagation();
|
||||
}}
|
||||
>
|
||||
<SettingsSection>
|
||||
<SettingsSection heading={_t("settings|voip|voice_input_section")}>
|
||||
{_t("settings|voip|voice_input_description")}
|
||||
{requestButton}
|
||||
<SettingsSubsection heading={_t("settings|voip|voice_section")} stretchContent>
|
||||
{speakerDropdown}
|
||||
{microphoneDropdown}
|
||||
<SettingsToggleInput
|
||||
name="voice-auto-gain"
|
||||
label={_t("settings|voip|voice_agc")}
|
||||
checked={this.state.audioAutoGainControl}
|
||||
onChange={this.onAutoGainChanged}
|
||||
/>
|
||||
</SettingsSubsection>
|
||||
<SettingsSubsection heading={_t("settings|voip|video_section")} stretchContent>
|
||||
{webcamDropdown}
|
||||
<SettingsFlag name="VideoView.flipVideoHorizontally" level={SettingLevel.ACCOUNT} />
|
||||
</SettingsSubsection>
|
||||
{microphoneDropdown}
|
||||
</SettingsSection>
|
||||
|
||||
<SettingsSection heading={_t("common|advanced")}>
|
||||
<SettingsSubsection heading={_t("settings|voip|voice_processing")}>
|
||||
{allowLegacyCalls && (
|
||||
<SettingsSection heading={_t("common|legacy_voice_and_video_settings")}>
|
||||
{elementCallEnabled && (
|
||||
// allow configuring Legacy calls if EC is also avalibale (otherwise we always show the legacySettingsComponent)
|
||||
<SettingsFlag name="enableLegacyCallsVoip" level={SettingLevel.DEVICE} />
|
||||
)}
|
||||
{(!elementCallEnabled || showLegacySettings) && legacySettingsComponent}
|
||||
</SettingsSection>
|
||||
)}
|
||||
{(allowLegacyCalls || elementCallEnabled) && (
|
||||
<SettingsSection heading={_t("settings|voip|voice_processing")}>
|
||||
<SettingsToggleInput
|
||||
name="voice-noise-suppression"
|
||||
label={_t("settings|voip|noise_suppression")}
|
||||
@@ -227,23 +289,8 @@ export default class VoiceUserSettingsTab extends React.Component<EmptyObject, I
|
||||
checked={this.state.audioEchoCancellation}
|
||||
onChange={this.onEchoCancellationChanged}
|
||||
/>
|
||||
</SettingsSubsection>
|
||||
<SettingsSubsection heading={_t("settings|voip|connection_section")}>
|
||||
<SettingsFlag
|
||||
name="webRtcAllowPeerToPeer"
|
||||
level={SettingLevel.DEVICE}
|
||||
onChange={this.changeWebRtcMethod}
|
||||
/>
|
||||
<SettingsFlag
|
||||
name="fallbackICEServerAllowed"
|
||||
label={_t("settings|voip|enable_fallback_ice_server", {
|
||||
server: new URL(FALLBACK_ICE_SERVER).pathname,
|
||||
})}
|
||||
level={SettingLevel.DEVICE}
|
||||
hideIfCannotSet
|
||||
/>
|
||||
</SettingsSubsection>
|
||||
</SettingsSection>
|
||||
</SettingsSection>
|
||||
)}
|
||||
</Form.Root>
|
||||
</SettingsTab>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user