From 3097ac8cc42bd99908a9403f155ba5c4dd432d34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Thu, 7 Apr 2022 16:45:01 +0200 Subject: [PATCH] fix(ios) fix not showing the CarPlay audio interface --- ios/sdk/src/AudioMode.m | 5 ++++- lang/main.json | 1 + react/features/base/icons/svg/car.svg | 3 +++ react/features/base/icons/svg/index.js | 1 + .../components/AudioRoutePickerDialog.js | 17 ++++++++++++++--- 5 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 react/features/base/icons/svg/car.svg diff --git a/ios/sdk/src/AudioMode.m b/ios/sdk/src/AudioMode.m index 3034e6b67..f2804d544 100644 --- a/ios/sdk/src/AudioMode.m +++ b/ios/sdk/src/AudioMode.m @@ -35,9 +35,10 @@ typedef enum { static NSString * const kDevicesChanged = @"org.jitsi.meet:features/audio-mode#devices-update"; // Device types (must match JS and Java) -static NSString * const kDeviceTypeHeadphones = @"HEADPHONES"; static NSString * const kDeviceTypeBluetooth = @"BLUETOOTH"; +static NSString * const kDeviceTypeCar = @"CAR"; static NSString * const kDeviceTypeEarpiece = @"EARPIECE"; +static NSString * const kDeviceTypeHeadphones = @"HEADPHONES"; static NSString * const kDeviceTypeSpeaker = @"SPEAKER"; static NSString * const kDeviceTypeUnknown = @"UNKNOWN"; @@ -320,6 +321,8 @@ RCT_EXPORT_METHOD(updateDeviceList) { || [portType isEqualToString:AVAudioSessionPortBluetoothLE] || [portType isEqualToString:AVAudioSessionPortBluetoothA2DP]) { return kDeviceTypeBluetooth; + } else if ([portType isEqualToString:AVAudioSessionPortCarAudio]) { + return kDeviceTypeCar; } else { return kDeviceTypeUnknown; } diff --git a/lang/main.json b/lang/main.json index b96bf1be2..eaa142e90 100644 --- a/lang/main.json +++ b/lang/main.json @@ -31,6 +31,7 @@ }, "audioDevices": { "bluetooth": "Bluetooth", + "car": "Car Audio", "headphones": "Headphones", "none": "No audio devices available", "phone": "Phone", diff --git a/react/features/base/icons/svg/car.svg b/react/features/base/icons/svg/car.svg new file mode 100644 index 000000000..f43424e9d --- /dev/null +++ b/react/features/base/icons/svg/car.svg @@ -0,0 +1,3 @@ + + + diff --git a/react/features/base/icons/svg/index.js b/react/features/base/icons/svg/index.js index 0cd16ee8e..9bf6feae0 100644 --- a/react/features/base/icons/svg/index.js +++ b/react/features/base/icons/svg/index.js @@ -22,6 +22,7 @@ export { default as IconCameraEmpty } from './camera-empty.svg'; export { default as IconCameraEmptyDisabled } from './camera-empty-disabled.svg'; export { default as IconCameraRefresh } from './camera-refresh.svg'; export { default as IconCancelSelection } from './cancel.svg'; +export { default as IconCar } from './car.svg'; export { default as IconChat } from './chat.svg'; export { default as IconChatSend } from './send.svg'; export { default as IconChatUnread } from './chat-unread.svg'; diff --git a/react/features/mobile/audio-mode/components/AudioRoutePickerDialog.js b/react/features/mobile/audio-mode/components/AudioRoutePickerDialog.js index a247fdc51..45c46f2b0 100644 --- a/react/features/mobile/audio-mode/components/AudioRoutePickerDialog.js +++ b/react/features/mobile/audio-mode/components/AudioRoutePickerDialog.js @@ -9,6 +9,7 @@ import { hideDialog, BottomSheet } from '../../../base/dialog'; import { translate } from '../../../base/i18n'; import { Icon, + IconCar, IconDeviceBluetooth, IconDeviceEarpiece, IconDeviceHeadphone, @@ -125,6 +126,11 @@ const deviceInfoMap = { text: 'audioDevices.bluetooth', type: 'BLUETOOTH' }, + CAR: { + icon: IconCar, + text: 'audioDevices.car', + type: 'CAR' + }, EARPIECE: { icon: IconDeviceEarpiece, text: 'audioDevices.phone', @@ -166,7 +172,7 @@ class AudioRoutePickerDialog extends Component { * @inheritdoc */ static getDerivedStateFromProps(props: Props) { - const { _devices: devices } = props; + const { _devices: devices, t } = props; if (!devices) { return null; @@ -183,13 +189,18 @@ class AudioRoutePickerDialog extends Component { continue; } - const text = device.type === 'BLUETOOTH' && device.name ? device.name : infoMap.text; + let text = t(infoMap.text); + + // iOS provides descriptive names for these, use it. + if ((device.type === 'BLUETOOTH' || device.type === 'CAR') && device.name) { + text = device.name; + } if (infoMap) { const info = { ...infoMap, selected: Boolean(device.selected), - text: props.t(text), + text, uid: device.uid };