Fix to-device encryption info label

The label was shown also without checking that we use PerParticipantE2EE. Which is a prerequisite for toDevice transport. As a result the label was shown when not desired.
This commit is contained in:
Timo
2025-05-13 20:58:21 +02:00
parent 04bc6c77a3
commit 04c900946c

View File

@@ -56,7 +56,7 @@ import { type OTelGroupCallMembership } from "../otel/OTelGroupCallMembership";
import { SettingsModal, defaultSettingsTab } from "../settings/SettingsModal"; import { SettingsModal, defaultSettingsTab } from "../settings/SettingsModal";
import { useRageshakeRequestModal } from "../settings/submit-rageshake"; import { useRageshakeRequestModal } from "../settings/submit-rageshake";
import { RageshakeRequestModal } from "./RageshakeRequestModal"; import { RageshakeRequestModal } from "./RageshakeRequestModal";
import { useLiveKit } from "../livekit/useLiveKit"; import { useLivekit } from "../livekit/useLivekit.ts";
import { useWakeLock } from "../useWakeLock"; import { useWakeLock } from "../useWakeLock";
import { useMergedRefs } from "../useMergedRefs"; import { useMergedRefs } from "../useMergedRefs";
import { type MuteStates } from "./MuteStates"; import { type MuteStates } from "./MuteStates";
@@ -73,7 +73,10 @@ import {
import { Grid, type TileProps } from "../grid/Grid"; import { Grid, type TileProps } from "../grid/Grid";
import { useInitial } from "../useInitial"; import { useInitial } from "../useInitial";
import { SpotlightTile } from "../tile/SpotlightTile"; import { SpotlightTile } from "../tile/SpotlightTile";
import { type EncryptionSystem } from "../e2ee/sharedKeyManagement"; import {
useRoomEncryptionSystem,
type EncryptionSystem,
} from "../e2ee/sharedKeyManagement";
import { E2eeType } from "../e2ee/e2eeType"; import { E2eeType } from "../e2ee/e2eeType";
import { makeGridLayout } from "../grid/GridLayout"; import { makeGridLayout } from "../grid/GridLayout";
import { import {
@@ -115,7 +118,7 @@ export interface ActiveCallProps
export const ActiveCall: FC<ActiveCallProps> = (props) => { export const ActiveCall: FC<ActiveCallProps> = (props) => {
const sfuConfig = useOpenIDSFU(props.client, props.rtcSession); const sfuConfig = useOpenIDSFU(props.client, props.rtcSession);
const { livekitRoom, connState } = useLiveKit( const { livekitRoom, connState } = useLivekit(
props.rtcSession, props.rtcSession,
props.muteStates, props.muteStates,
sfuConfig, sfuConfig,
@@ -223,19 +226,24 @@ export const InCallView: FC<InCallViewProps> = ({
const [muteAllAudio] = useSetting(muteAllAudioSetting); const [muteAllAudio] = useSetting(muteAllAudioSetting);
const [toDeviceEncryptionSetting] = useSetting( // This seems like it might be enough logic to use move it into the call view model?
useExperimentalToDeviceTransportSetting, const [didFallbackToRoomKey, setDidFallbackToRoomKey] = useState(false);
);
const [showToDeviceEncryption, setShowToDeviceEncryption] = useState(
() => toDeviceEncryptionSetting,
);
useEffect(() => {
setShowToDeviceEncryption(toDeviceEncryptionSetting);
}, [toDeviceEncryptionSetting]);
useTypedEventEmitter( useTypedEventEmitter(
rtcSession, rtcSession,
RoomAndToDeviceEvents.EnabledTransportsChanged, RoomAndToDeviceEvents.EnabledTransportsChanged,
(enabled) => setShowToDeviceEncryption(enabled.to_device), (enabled) => setDidFallbackToRoomKey(enabled.room),
);
const [toDeviceEncryptionSetting] = useSetting(
useExperimentalToDeviceTransportSetting,
);
const encryptionSystem = useRoomEncryptionSystem(rtcSession.room.roomId);
const showToDeviceEncryption = useMemo(
() =>
toDeviceEncryptionSetting &&
encryptionSystem.kind === E2eeType.PER_PARTICIPANT &&
!didFallbackToRoomKey,
[encryptionSystem.kind, didFallbackToRoomKey, toDeviceEncryptionSetting],
); );
const toggleMicrophone = useCallback( const toggleMicrophone = useCallback(