make the settings naming consistent

This commit is contained in:
Timo
2025-05-13 21:30:00 +02:00
parent 19228544a9
commit bf576ca4c4
7 changed files with 20 additions and 16 deletions

View File

@@ -42,7 +42,7 @@ import {
import { E2eeType } from "../e2ee/e2eeType"; import { E2eeType } from "../e2ee/e2eeType";
import { getBasicCallViewModelEnvironment } from "../utils/test-viewmodel"; import { getBasicCallViewModelEnvironment } from "../utils/test-viewmodel";
import { alice, local } from "../utils/test-fixtures"; import { alice, local } from "../utils/test-fixtures";
import { useExperimentalToDeviceTransportSetting } from "../settings/settings"; import { useExperimentalToDeviceTransport as useExperimentalToDeviceTransportSetting } from "../settings/settings";
import { ReactionsSenderProvider } from "../reactions/useReactionsSender"; import { ReactionsSenderProvider } from "../reactions/useReactionsSender";
import { useRoomEncryptionSystem } from "../e2ee/sharedKeyManagement"; import { useRoomEncryptionSystem } from "../e2ee/sharedKeyManagement";

View File

@@ -233,17 +233,21 @@ export const InCallView: FC<InCallViewProps> = ({
RoomAndToDeviceEvents.EnabledTransportsChanged, RoomAndToDeviceEvents.EnabledTransportsChanged,
(enabled) => setDidFallbackToRoomKey(enabled.room), (enabled) => setDidFallbackToRoomKey(enabled.room),
); );
const [toDeviceEncryptionSetting] = useSetting( const [useExperimentalToDeviceTransport] = useSetting(
useExperimentalToDeviceTransportSetting, useExperimentalToDeviceTransportSetting,
); );
const encryptionSystem = useRoomEncryptionSystem(rtcSession.room.roomId); const encryptionSystem = useRoomEncryptionSystem(rtcSession.room.roomId);
const showToDeviceEncryption = useMemo( const showToDeviceEncryption = useMemo(
() => () =>
toDeviceEncryptionSetting && useExperimentalToDeviceTransport &&
encryptionSystem.kind === E2eeType.PER_PARTICIPANT && encryptionSystem.kind === E2eeType.PER_PARTICIPANT &&
!didFallbackToRoomKey, !didFallbackToRoomKey,
[encryptionSystem.kind, didFallbackToRoomKey, toDeviceEncryptionSetting], [
encryptionSystem.kind,
didFallbackToRoomKey,
useExperimentalToDeviceTransport,
],
); );
const toggleMicrophone = useCallback( const toggleMicrophone = useCallback(

View File

@@ -21,8 +21,8 @@ import { act, type ReactNode } from "react";
import { ReactionsAudioRenderer } from "./ReactionAudioRenderer"; import { ReactionsAudioRenderer } from "./ReactionAudioRenderer";
import { import {
playReactionsSound, playReactionsSound as playReactionsSoundSetting,
soundEffectVolumeSetting, soundEffectVolume as soundEffectVolumeSetting,
} from "../settings/settings"; } from "../settings/settings";
import { useAudioContext } from "../useAudioContext"; import { useAudioContext } from "../useAudioContext";
import { GenericReaction, ReactionSet } from "../reactions"; import { GenericReaction, ReactionSet } from "../reactions";
@@ -50,7 +50,7 @@ vitest.mock("../soundUtils");
afterEach(() => { afterEach(() => {
vitest.resetAllMocks(); vitest.resetAllMocks();
playReactionsSound.setValue(playReactionsSound.defaultValue); playReactionsSoundSetting.setValue(playReactionsSoundSetting.defaultValue);
soundEffectVolumeSetting.setValue(soundEffectVolumeSetting.defaultValue); soundEffectVolumeSetting.setValue(soundEffectVolumeSetting.defaultValue);
}); });
@@ -74,7 +74,7 @@ beforeEach(() => {
test("preloads all audio elements", () => { test("preloads all audio elements", () => {
const { vm } = getBasicCallViewModelEnvironment([local, alice]); const { vm } = getBasicCallViewModelEnvironment([local, alice]);
playReactionsSound.setValue(true); playReactionsSoundSetting.setValue(true);
render(<TestComponent vm={vm} />); render(<TestComponent vm={vm} />);
expect(prefetchSounds).toHaveBeenCalledOnce(); expect(prefetchSounds).toHaveBeenCalledOnce();
}); });
@@ -84,7 +84,7 @@ test("will play an audio sound when there is a reaction", () => {
local, local,
alice, alice,
]); ]);
playReactionsSound.setValue(true); playReactionsSoundSetting.setValue(true);
render(<TestComponent vm={vm} />); render(<TestComponent vm={vm} />);
// Find the first reaction with a sound effect // Find the first reaction with a sound effect
@@ -110,7 +110,7 @@ test("will play the generic audio sound when there is soundless reaction", () =>
local, local,
alice, alice,
]); ]);
playReactionsSound.setValue(true); playReactionsSoundSetting.setValue(true);
render(<TestComponent vm={vm} />); render(<TestComponent vm={vm} />);
// Find the first reaction with a sound effect // Find the first reaction with a sound effect
@@ -136,7 +136,7 @@ test("will play multiple audio sounds when there are multiple different reaction
local, local,
alice, alice,
]); ]);
playReactionsSound.setValue(true); playReactionsSoundSetting.setValue(true);
render(<TestComponent vm={vm} />); render(<TestComponent vm={vm} />);
// Find the first reaction with a sound effect // Find the first reaction with a sound effect

View File

@@ -23,7 +23,7 @@ import {
import { widget } from "../widget"; import { widget } from "../widget";
import { import {
useSetting, useSetting,
soundEffectVolumeSetting, soundEffectVolume as soundEffectVolumeSetting,
backgroundBlur as backgroundBlurSetting, backgroundBlur as backgroundBlurSetting,
developerMode, developerMode,
} from "./settings"; } from "./settings";

View File

@@ -110,7 +110,7 @@ export const playReactionsSound = new Setting<boolean>(
true, true,
); );
export const soundEffectVolumeSetting = new Setting<number>( export const soundEffectVolume = new Setting<number>(
"sound-effect-volume", "sound-effect-volume",
0.5, 0.5,
); );

View File

@@ -12,7 +12,7 @@ import userEvent from "@testing-library/user-event";
import { deviceStub, MediaDevicesContext } from "./livekit/MediaDevicesContext"; import { deviceStub, MediaDevicesContext } from "./livekit/MediaDevicesContext";
import { useAudioContext } from "./useAudioContext"; import { useAudioContext } from "./useAudioContext";
import { soundEffectVolumeSetting } from "./settings/settings"; import { soundEffectVolume as soundEffectVolumeSetting } from "./settings/settings";
const staticSounds = Promise.resolve({ const staticSounds = Promise.resolve({
aSound: new ArrayBuffer(0), aSound: new ArrayBuffer(0),

View File

@@ -9,7 +9,7 @@ import { logger } from "matrix-js-sdk/lib/logger";
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import { import {
soundEffectVolumeSetting as effectSoundVolumeSetting, soundEffectVolume as soundEffectVolumeSetting,
useSetting, useSetting,
} from "./settings/settings"; } from "./settings/settings";
import { useMediaDevices } from "./livekit/MediaDevicesContext"; import { useMediaDevices } from "./livekit/MediaDevicesContext";
@@ -63,7 +63,7 @@ interface UseAudioContext<S> {
export function useAudioContext<S extends string>( export function useAudioContext<S extends string>(
props: Props<S>, props: Props<S>,
): UseAudioContext<S> | null { ): UseAudioContext<S> | null {
const [effectSoundVolume] = useSetting(effectSoundVolumeSetting); const [effectSoundVolume] = useSetting(soundEffectVolumeSetting);
const devices = useMediaDevices(); const devices = useMediaDevices();
const [audioContext, setAudioContext] = useState<AudioContext>(); const [audioContext, setAudioContext] = useState<AudioContext>();
const [audioBuffers, setAudioBuffers] = useState<Record<S, AudioBuffer>>(); const [audioBuffers, setAudioBuffers] = useState<Record<S, AudioBuffer>>();