diff --git a/src/IConfigOptions.ts b/src/IConfigOptions.ts index 9739cc8870..d8c26909df 100644 --- a/src/IConfigOptions.ts +++ b/src/IConfigOptions.ts @@ -117,9 +117,9 @@ export interface IConfigOptions { obey_asserted_identity?: boolean; // MSC3086 }; element_call: { - url: string; - use_exclusively: boolean; - brand: string; + url?: string; + use_exclusively?: boolean; + brand?: string; }; logout_redirect_url?: string; diff --git a/src/components/views/rooms/RoomHeader.tsx b/src/components/views/rooms/RoomHeader.tsx index 6f0eac864f..013a992698 100644 --- a/src/components/views/rooms/RoomHeader.tsx +++ b/src/components/views/rooms/RoomHeader.tsx @@ -52,7 +52,7 @@ import { UPDATE_EVENT } from "../../../stores/AsyncStore"; import { isVideoRoom as calcIsVideoRoom } from "../../../utils/video-rooms"; import LegacyCallHandler, { LegacyCallHandlerEvent } from "../../../LegacyCallHandler"; import { useFeatureEnabled, useSettingValue } from "../../../hooks/useSettings"; -import SdkConfig from "../../../SdkConfig"; +import SdkConfig, { DEFAULTS } from "../../../SdkConfig"; import { useEventEmitterState, useTypedEventEmitterState } from "../../../hooks/useEventEmitter"; import { useWidgets } from "../right_panel/RoomSummaryCard"; import { WidgetType } from "../../../widgets/WidgetType"; @@ -195,7 +195,7 @@ const VideoCallButton: FC = ({ room, busy, setBusy, behavi let menu: JSX.Element | null = null; if (menuOpen) { const buttonRect = buttonRef.current!.getBoundingClientRect(); - const brand = SdkConfig.get("element_call").brand; + const brand = SdkConfig.get("element_call").brand ?? DEFAULTS.element_call.brand; menu = @@ -230,7 +230,9 @@ const CallButtons: FC = ({ room }) => { const groupCallsEnabled = useFeatureEnabled("feature_group_calls"); const videoRoomsEnabled = useFeatureEnabled("feature_video_rooms"); const isVideoRoom = useMemo(() => videoRoomsEnabled && calcIsVideoRoom(room), [videoRoomsEnabled, room]); - const useElementCallExclusively = useMemo(() => SdkConfig.get("element_call").use_exclusively, []); + const useElementCallExclusively = useMemo(() => { + return SdkConfig.get("element_call").use_exclusively ?? DEFAULTS.element_call.use_exclusively; + }, []); const hasLegacyCall = useEventEmitterState( LegacyCallHandler.instance, diff --git a/src/components/views/settings/tabs/room/RolesRoomSettingsTab.tsx b/src/components/views/settings/tabs/room/RolesRoomSettingsTab.tsx index 1c70c3ea39..5da3996154 100644 --- a/src/components/views/settings/tabs/room/RolesRoomSettingsTab.tsx +++ b/src/components/views/settings/tabs/room/RolesRoomSettingsTab.tsx @@ -32,7 +32,7 @@ import SettingsFieldset from '../../SettingsFieldset'; import SettingsStore from "../../../../../settings/SettingsStore"; import { VoiceBroadcastInfoEventType } from '../../../../../voice-broadcast'; import { ElementCall } from "../../../../../models/Call"; -import SdkConfig from "../../../../../SdkConfig"; +import SdkConfig, { DEFAULTS } from "../../../../../SdkConfig"; interface IEventShowOpts { isState?: boolean; @@ -446,7 +446,7 @@ export default class RolesRoomSettingsTab extends React.Component { let label = plEventsToLabels[eventType]; if (label) { - const brand = SdkConfig.get("element_call").brand; + const brand = SdkConfig.get("element_call").brand ?? DEFAULTS.element_call.brand; label = _t(label, { brand }); } else { label = _t("Send %(eventType)s events", { eventType }); diff --git a/src/components/views/settings/tabs/room/VoipRoomSettingsTab.tsx b/src/components/views/settings/tabs/room/VoipRoomSettingsTab.tsx index 29863b64aa..b8dca6205c 100644 --- a/src/components/views/settings/tabs/room/VoipRoomSettingsTab.tsx +++ b/src/components/views/settings/tabs/room/VoipRoomSettingsTab.tsx @@ -25,7 +25,7 @@ import SettingsSubsection from "../../shared/SettingsSubsection"; import SettingsTab from "../SettingsTab"; import { ElementCall } from "../../../../../models/Call"; import { useRoomState } from "../../../../../hooks/useRoomState"; -import SdkConfig from "../../../../../SdkConfig"; +import SdkConfig, { DEFAULTS } from "../../../../../SdkConfig"; interface ElementCallSwitchProps { roomId: string; @@ -69,7 +69,7 @@ const ElementCallSwitch: React.FC = ({ roomId }) => { }); }, [roomId, content, events, isPublic]); - const brand = SdkConfig.get("element_call").brand; + const brand = SdkConfig.get("element_call").brand ?? DEFAULTS.element_call.brand; return