The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/hooks/useUserSoundPreferences.ts

15 lines
656 B

import { useUserPreference } from '@rocket.chat/ui-contexts';
const relativeVolume = (volume: number, masterVolume: number) => (volume * masterVolume) / 100;
export const useUserSoundPreferences = () => {
const masterVolume = useUserPreference<number>('masterVolume', 100) ?? 100;
const notificationsSoundVolume = useUserPreference<number>('notificationsSoundVolume', 100) ?? 100;
const voipRingerVolume = useUserPreference<number>('voipRingerVolume', 100) ?? 100;
return {
masterVolume,
notificationsSoundVolume: relativeVolume(notificationsSoundVolume, masterVolume),
voipRingerVolume: relativeVolume(voipRingerVolume, masterVolume),
};
};