Extract place call logic to its own file (#11494)

* Extract place call logic to its own file

* Simplify makeCall by not using useCallback

* lint fix
This commit is contained in:
Germain 2023-08-31 14:27:15 +01:00 committed by GitHub
parent c7b0850ffe
commit 77a468f8e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 65 additions and 41 deletions

View file

@ -28,7 +28,7 @@ import { _t } from "../../languageHandler";
import { useRoomMemberCount } from "../useRoomMembers";
import { ElementCall } from "../../models/Call";
type CallType = "element_call" | "jitsi_or_element_call" | "legacy_or_jitsi";
export type PlatformCallType = "element_call" | "jitsi_or_element_call" | "legacy_or_jitsi";
const DEFAULT_DISABLED_REASON = null;
const DEFAULT_CALL_TYPE = "jitsi_or_element_call";
@ -42,14 +42,14 @@ export const useRoomCallStatus = (
room: Room,
): {
voiceCallDisabledReason: string | null;
voiceCallType: CallType;
voiceCallType: PlatformCallType;
videoCallDisabledReason: string | null;
videoCallType: CallType;
videoCallType: PlatformCallType;
} => {
const [voiceCallDisabledReason, setVoiceCallDisabledReason] = useState<string | null>(DEFAULT_DISABLED_REASON);
const [videoCallDisabledReason, setVideoCallDisabledReason] = useState<string | null>(DEFAULT_DISABLED_REASON);
const [voiceCallType, setVoiceCallType] = useState<CallType>(DEFAULT_CALL_TYPE);
const [videoCallType, setVideoCallType] = useState<CallType>(DEFAULT_CALL_TYPE);
const [voiceCallType, setVoiceCallType] = useState<PlatformCallType>(DEFAULT_CALL_TYPE);
const [videoCallType, setVideoCallType] = useState<PlatformCallType>(DEFAULT_CALL_TYPE);
const groupCallsEnabled = useFeatureEnabled("feature_group_calls");
const useElementCallExclusively = useMemo(() => {