A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
feat(app): label voice devices when connection ids are hidden
Hampusecb54d5d14d6
diff --git a/fluxer_app/src/features/app/components/layout/VoiceParticipantItem.tsx b/fluxer_app/src/features/app/components/layout/VoiceParticipantItem.tsxindex edb7a6056..57cca94f5 100644--- a/fluxer_app/src/features/app/components/layout/VoiceParticipantItem.tsx+++ b/fluxer_app/src/features/app/components/layout/VoiceParticipantItem.tsx@@ -27,6 +27,7 @@ import {resolveVoiceParticipantDisplayState} from '@app/features/voice/componentimport MediaEngine, {useMediaEngineVersion} from '@app/features/voice/engine/MediaEngineFacade';import {useStreamWatchDoubleClick} from '@app/features/voice/hooks/useStreamWatchDoubleClick';import LocalVoiceState from '@app/features/voice/state/LocalVoiceState';+import VoiceSettings from '@app/features/voice/state/VoiceSettings';import {buildVoiceParticipantIdentity} from '@app/features/voice/utils/VoiceParticipantIdentity';import {isParticipantVoicePermissionMuted} from '@app/features/voice/utils/VoicePermissionUtils';import {ME} from '@fluxer/constants/src/AppConstants';@@ -45,6 +46,16 @@ const UNKNOWN_DEVICE_DESCRIPTOR = msg({message: 'Unknown device',comment: 'Short label in the app layout voice participant item.',});+const MOBILE_DEVICE_DESCRIPTOR = msg({+ message: 'Mobile device',+ comment:+ 'Name of one of several voice connections of the same person, shown in place of the connection ID when the user hides connection IDs.',+});+const DESKTOP_DEVICE_DESCRIPTOR = msg({+ message: 'Desktop device',+ comment:+ 'Name of one of several voice connections of the same person, shown in place of the connection ID when the user hides connection IDs.',+});const OPEN_PROFILE_FOR_DESCRIPTOR = msg({message: 'Open profile for {displayName}',comment: 'Short label in the app layout voice participant item. Preserve {displayName}; it is inserted by code.',@@ -188,9 +199,14 @@ export const VoiceParticipantItem = observer(function VoiceParticipantItem({setIsProfilePopoutOpen(false);}, []);const DeviceIcon = voiceState?.is_mobile ? DeviceMobileIcon : DesktopIcon;- const unknownDeviceFallback = useMemo(() => i18n._(UNKNOWN_DEVICE_DESCRIPTOR), [i18n.locale]);+ const showConnectionId = VoiceSettings.showVoiceConnectionId;+ const deviceName = useMemo(() => {+ if (showConnectionId && voiceState?.connection_id) return voiceState.connection_id;+ if (!voiceState) return i18n._(UNKNOWN_DEVICE_DESCRIPTOR);+ return i18n._(voiceState.is_mobile ? MOBILE_DEVICE_DESCRIPTOR : DESKTOP_DEVICE_DESCRIPTOR);+ }, [i18n.locale, showConnectionId, voiceState?.connection_id, voiceState?.is_mobile]);const displayName = isGroupedItem- ? voiceState?.connection_id || unknownDeviceFallback+ ? deviceName: NicknameUtils.getNickname(user, guildId, currentChannelId ?? undefined);const openProfileAriaLabel = !isGroupedItem ? i18n._(OPEN_PROFILE_FOR_DESCRIPTOR, {displayName}) : undefined;const row = (