mirror of
https://github.com/vector-im/element-call.git
synced 2026-07-24 19:19:21 +00:00
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:
@@ -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 {
|
||||||
@@ -96,7 +99,7 @@ import { ReactionsOverlay } from "./ReactionsOverlay";
|
|||||||
import { CallEventAudioRenderer } from "./CallEventAudioRenderer";
|
import { CallEventAudioRenderer } from "./CallEventAudioRenderer";
|
||||||
import {
|
import {
|
||||||
debugTileLayout as debugTileLayoutSetting,
|
debugTileLayout as debugTileLayoutSetting,
|
||||||
useExperimentalToDeviceTransportSetting,
|
useExperimentalToDeviceTransportSetting as useToDeviceTransportSetting,
|
||||||
useSetting,
|
useSetting,
|
||||||
} from "../settings/settings";
|
} from "../settings/settings";
|
||||||
import { ReactionsReader } from "../reactions/ReactionsReader";
|
import { ReactionsReader } from "../reactions/ReactionsReader";
|
||||||
@@ -220,19 +223,21 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
room: livekitRoom,
|
room: livekitRoom,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [toDeviceEncryptionSetting] = useSetting(
|
const [didFallbackToRoomKey, setDidFallbackToRoomKey] = useState(false);
|
||||||
useExperimentalToDeviceTransportSetting,
|
|
||||||
);
|
|
||||||
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(useToDeviceTransportSetting);
|
||||||
|
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(
|
||||||
|
|||||||
Reference in New Issue
Block a user