From 8e19473b521c4315a01199b08968fe28abdac34c Mon Sep 17 00:00:00 2001 From: reuk Date: Tue, 7 Jul 2020 12:26:29 +0100 Subject: [PATCH] macOS: Add NSBluetoothAlwaysUsageDescription to macOS plists as well as iOS ones --- docs/CMake API.md | 4 +-- extras/Build/CMake/JUCEUtils.cmake | 4 +-- .../utils/juce_PlistOptions.cpp | 6 ++-- .../ProjectSaving/jucer_ProjectExport_Xcode.h | 28 +++++++++---------- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/docs/CMake API.md b/docs/CMake API.md index bd5de10be7..8551eba42d 100644 --- a/docs/CMake API.md +++ b/docs/CMake API.md @@ -196,10 +196,10 @@ attributes directly to these creation functions, rather than adding them later. - The text your app will display when it requests camera permissions. - `BLUETOOTH_PERMISSION_ENABLED` - - May be either TRUE or FALSE. Adds the appropriate entries to an iOS app's Info.plist. + - May be either TRUE or FALSE. Adds the appropriate entries to an app's Info.plist. - `BLUETOOTH_PERMISSION_TEXT` - - The text your iOS app will display when it requests bluetooth permissions. + - The text your app will display when it requests bluetooth permissions. - `SEND_APPLE_EVENTS_PERMISSION_ENABLED` - May be either TRUE or FALSE. Enable this to allow your app to send Apple events. diff --git a/extras/Build/CMake/JUCEUtils.cmake b/extras/Build/CMake/JUCEUtils.cmake index c033aae1e2..37e4d2f318 100644 --- a/extras/Build/CMake/JUCEUtils.cmake +++ b/extras/Build/CMake/JUCEUtils.cmake @@ -1812,8 +1812,8 @@ function(_juce_initialise_target target) CAMERA_PERMISSION_TEXT SEND_APPLE_EVENTS_PERMISSION_ENABLED SEND_APPLE_EVENTS_PERMISSION_TEXT - BLUETOOTH_PERMISSION_ENABLED # iOS only - BLUETOOTH_PERMISSION_TEXT # iOS only + BLUETOOTH_PERMISSION_ENABLED + BLUETOOTH_PERMISSION_TEXT FILE_SHARING_ENABLED # iOS only DOCUMENT_BROWSER_ENABLED # iOS only LAUNCH_STORYBOARD_FILE # iOS only diff --git a/extras/Build/juce_build_tools/utils/juce_PlistOptions.cpp b/extras/Build/juce_build_tools/utils/juce_PlistOptions.cpp index d8b931a3b2..18826097cb 100644 --- a/extras/Build/juce_build_tools/utils/juce_PlistOptions.cpp +++ b/extras/Build/juce_build_tools/utils/juce_PlistOptions.cpp @@ -125,13 +125,13 @@ namespace build_tools if (cameraPermissionEnabled) addPlistDictionaryKey (*dict, "NSCameraUsageDescription", cameraPermissionText); + if (bluetoothPermissionEnabled) + addPlistDictionaryKey (*dict, "NSBluetoothAlwaysUsageDescription", bluetoothPermissionText); + if (iOS) { if (bluetoothPermissionEnabled) - { - addPlistDictionaryKey (*dict, "NSBluetoothAlwaysUsageDescription", bluetoothPermissionText); addPlistDictionaryKey (*dict, "NSBluetoothPeripheralUsageDescription", bluetoothPermissionText); // needed for pre iOS 13.0 - } addPlistDictionaryKey (*dict, "LSRequiresIPhoneOS", true); diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h index 92c3a07c3e..ca426bc04f 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h @@ -159,8 +159,8 @@ public: cameraPermissionNeededValue (settings, Ids::cameraPermissionNeeded, getUndoManager()), cameraPermissionTextValue (settings, Ids::cameraPermissionText, getUndoManager(), "This app requires access to the camera to function correctly."), - iosBluetoothPermissionNeededValue (settings, Ids::iosBluetoothPermissionNeeded, getUndoManager()), - iosBluetoothPermissionTextValue (settings, Ids::iosBluetoothPermissionText, getUndoManager(), + bluetoothPermissionNeededValue (settings, Ids::iosBluetoothPermissionNeeded, getUndoManager()), + bluetoothPermissionTextValue (settings, Ids::iosBluetoothPermissionText, getUndoManager(), "This app requires access to Bluetooth to function correctly."), sendAppleEventsPermissionNeededValue (settings, Ids::sendAppleEventsPermissionNeeded, getUndoManager()), sendAppleEventsPermissionTextValue (settings, Ids::sendAppleEventsPermissionText, getUndoManager(), @@ -251,8 +251,8 @@ public: bool isCameraPermissionEnabled() const { return cameraPermissionNeededValue.get(); } String getCameraPermissionTextString() const { return cameraPermissionTextValue.get(); } - bool isBluetoothPermissionEnabled() const { return iosBluetoothPermissionNeededValue.get(); } - String getBluetoothPermissionTextString() const { return iosBluetoothPermissionTextValue.get(); } + bool isBluetoothPermissionEnabled() const { return bluetoothPermissionNeededValue.get(); } + String getBluetoothPermissionTextString() const { return bluetoothPermissionTextValue.get(); } bool isSendAppleEventsPermissionEnabled() const { return sendAppleEventsPermissionNeededValue.get(); } String getSendAppleEventsPermissionTextString() const { return sendAppleEventsPermissionTextValue.get(); } @@ -505,17 +505,15 @@ public: "Camera Access Text", 1024, false), "A short description of why your app requires camera access."); - if (iOS) - { - props.add (new ChoicePropertyComponent (iosBluetoothPermissionNeededValue, "Bluetooth Access"), - "Enable this to allow your app to use Bluetooth on iOS 13.0 and above. " - "The user of your app will be prompted to grant Bluetooth access permissions."); + props.add (new ChoicePropertyComponent (bluetoothPermissionNeededValue, "Bluetooth Access"), + "Enable this to allow your app to use Bluetooth on iOS 13.0 and above, and macOS 11.0 and above. " + "The user of your app will be prompted to grant Bluetooth access permissions."); - props.add (new TextPropertyComponentWithEnablement (iosBluetoothPermissionTextValue, iosBluetoothPermissionNeededValue, - "Bluetooth Access Text", 1024, false), - "A short description of why your app requires Bluetooth access."); - } - else + props.add (new TextPropertyComponentWithEnablement (bluetoothPermissionTextValue, bluetoothPermissionNeededValue, + "Bluetooth Access Text", 1024, false), + "A short description of why your app requires Bluetooth access."); + + if (! iOS) { props.add (new ChoicePropertyComponent (sendAppleEventsPermissionNeededValue, "Send Apple Events"), "Enable this to allow your app to send Apple events. " @@ -1924,7 +1922,7 @@ private: hardenedRuntimeValue, hardenedRuntimeOptionsValue, microphonePermissionNeededValue, microphonePermissionsTextValue, cameraPermissionNeededValue, cameraPermissionTextValue, - iosBluetoothPermissionNeededValue, iosBluetoothPermissionTextValue, + bluetoothPermissionNeededValue, bluetoothPermissionTextValue, sendAppleEventsPermissionNeededValue, sendAppleEventsPermissionTextValue, uiFileSharingEnabledValue, uiSupportsDocumentBrowserValue, uiStatusBarHiddenValue, documentExtensionsValue, iosInAppPurchasesValue, iosContentSharingValue, iosBackgroundAudioValue, iosBackgroundBleValue, iosPushNotificationsValue, iosAppGroupsValue, iCloudPermissionsValue,