@@ -10,7 +10,7 @@ import { type Room } from "matrix-js-sdk/src/matrix";
1010import React , { type ReactNode , useCallback , useEffect , useMemo , useState } from "react" ;
1111import { CallType } from "matrix-js-sdk/src/webrtc/call" ;
1212
13- import { useFeatureEnabled } from "../useSettings" ;
13+ import { useFeatureEnabled , useSettingValue } from "../useSettings" ;
1414import SdkConfig from "../../SdkConfig" ;
1515import { useEventEmitter , useEventEmitterState } from "../useEventEmitter" ;
1616import LegacyCallHandler , { LegacyCallHandlerEvent } from "../../LegacyCallHandler" ;
@@ -33,7 +33,6 @@ import { Action } from "../../dispatcher/actions";
3333import { CallStore , CallStoreEvent } from "../../stores/CallStore" ;
3434import { isVideoRoom } from "../../utils/video-rooms" ;
3535import { useGuestAccessInformation } from "./useGuestAccessInformation" ;
36- import SettingsStore from "../../settings/SettingsStore" ;
3736import { UIFeature } from "../../settings/UIFeature" ;
3837import { BetaPill } from "../../components/views/beta/BetaCard" ;
3938import { type InteractionName } from "../../PosthogTrackers" ;
@@ -102,6 +101,8 @@ export const useRoomCall = (
102101} => {
103102 // settings
104103 const groupCallsEnabled = useFeatureEnabled ( "feature_group_calls" ) ;
104+ const widgetsFeatureEnabled = useSettingValue ( UIFeature . Widgets ) ;
105+ const voipFeatureEnabled = useSettingValue ( UIFeature . Voip ) ;
105106 const useElementCallExclusively = useMemo ( ( ) => {
106107 return SdkConfig . get ( "element_call" ) . use_exclusively ;
107108 } , [ ] ) ;
@@ -285,8 +286,8 @@ export const useRoomCall = (
285286 // We hide the voice call button if it'd have the same effect as the video call button
286287 let hideVoiceCallButton = isManagedHybridWidgetEnabled ( room ) || ! callOptions . includes ( PlatformCallType . LegacyCall ) ;
287288 let hideVideoCallButton = false ;
288- // We hide both buttons if they require widgets but widgets are disabled.
289- if ( memberCount > 2 && ! SettingsStore . getValue ( UIFeature . Widgets ) ) {
289+ // We hide both buttons if they require widgets but widgets are disabled, or if the Voip feature is disabled .
290+ if ( ( memberCount > 2 && ! widgetsFeatureEnabled ) || ! voipFeatureEnabled ) {
290291 hideVoiceCallButton = true ;
291292 hideVideoCallButton = true ;
292293 }
0 commit comments