Commit 4c7bb448 by Jeroen Weener Committed by GitHub

Allow querying Bluetooth service status on iOS (main) (#1102)

* Update example app

* Update `Permission.bluetooth` documentation

* Update CHANGELOG.md
parent a2ab8524
## 10.4.3
* Updates example app to show relevant permissions on Android and iOS platforms.
* Updates the documentation for the `Permission.bluetooth` permission regarding the limitations of the permission on iOS.
## 10.4.2 ## 10.4.2
* Adds a [FAQ](https://pub.dev/packages/permission_handler#faq) section to the README.md file. * Adds a [FAQ](https://pub.dev/packages/permission_handler#faq) section to the README.md file.
......
...@@ -21,6 +21,6 @@ ...@@ -21,6 +21,6 @@
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.0</string> <string>1.0</string>
<key>MinimumOSVersion</key> <key>MinimumOSVersion</key>
<string>9.0</string> <string>11.0</string>
</dict> </dict>
</plist> </plist>
# Uncomment this line to define a global platform for your project # Uncomment this line to define a global platform for your project
# platform :ios, '9.0' # platform :ios, '11.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency. # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true' ENV['COCOAPODS_DISABLE_STATS'] = 'true'
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
archiveVersion = 1; archiveVersion = 1;
classes = { classes = {
}; };
objectVersion = 51; objectVersion = 54;
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
...@@ -199,10 +199,12 @@ ...@@ -199,10 +199,12 @@
/* Begin PBXShellScriptBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
inputPaths = ( inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
); );
name = "Thin Binary"; name = "Thin Binary";
outputPaths = ( outputPaths = (
...@@ -235,6 +237,7 @@ ...@@ -235,6 +237,7 @@
}; };
9740EEB61CF901F6004384FC /* Run Script */ = { 9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
...@@ -339,7 +342,7 @@ ...@@ -339,7 +342,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0; IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos; SUPPORTED_PLATFORMS = iphoneos;
...@@ -425,7 +428,7 @@ ...@@ -425,7 +428,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0; IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos; SDKROOT = iphoneos;
...@@ -474,7 +477,7 @@ ...@@ -474,7 +477,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0; IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos; SUPPORTED_PLATFORMS = iphoneos;
......
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion> <MacroExpansion>
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
...@@ -38,8 +36,8 @@ ...@@ -38,8 +36,8 @@
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>
</MacroExpansion> </MacroExpansion>
<AdditionalOptions> <Testables>
</AdditionalOptions> </Testables>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
buildConfiguration = "Debug" buildConfiguration = "Debug"
...@@ -61,8 +59,6 @@ ...@@ -61,8 +59,6 @@
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction> </LaunchAction>
<ProfileAction <ProfileAction
buildConfiguration = "Profile" buildConfiguration = "Profile"
......
...@@ -99,5 +99,9 @@ ...@@ -99,5 +99,9 @@
<!-- Permission options for the `appTrackingTransparency` --> <!-- Permission options for the `appTrackingTransparency` -->
<key>NSUserTrackingUsageDescription</key> <key>NSUserTrackingUsageDescription</key>
<string>appTrackingTransparency</string> <string>appTrackingTransparency</string>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict> </dict>
</plist> </plist>
...@@ -39,8 +39,8 @@ class _PermissionHandlerWidgetState extends State<PermissionHandlerWidget> { ...@@ -39,8 +39,8 @@ class _PermissionHandlerWidgetState extends State<PermissionHandlerWidget> {
.where((permission) { .where((permission) {
if (Platform.isIOS) { if (Platform.isIOS) {
return permission != Permission.unknown && return permission != Permission.unknown &&
permission != Permission.phone &&
permission != Permission.sms && permission != Permission.sms &&
permission != Permission.storage &&
permission != Permission.ignoreBatteryOptimizations && permission != Permission.ignoreBatteryOptimizations &&
permission != Permission.accessMediaLocation && permission != Permission.accessMediaLocation &&
permission != Permission.activityRecognition && permission != Permission.activityRecognition &&
...@@ -50,13 +50,18 @@ class _PermissionHandlerWidgetState extends State<PermissionHandlerWidget> { ...@@ -50,13 +50,18 @@ class _PermissionHandlerWidgetState extends State<PermissionHandlerWidget> {
permission != Permission.accessNotificationPolicy && permission != Permission.accessNotificationPolicy &&
permission != Permission.bluetoothScan && permission != Permission.bluetoothScan &&
permission != Permission.bluetoothAdvertise && permission != Permission.bluetoothAdvertise &&
permission != Permission.bluetoothConnect; permission != Permission.bluetoothConnect &&
permission != Permission.nearbyWifiDevices &&
permission != Permission.videos &&
permission != Permission.audio &&
permission != Permission.scheduleExactAlarm &&
permission != Permission.sensorsAlways;
} else { } else {
return permission != Permission.unknown && return permission != Permission.unknown &&
permission != Permission.mediaLibrary && permission != Permission.mediaLibrary &&
permission != Permission.photos &&
permission != Permission.photosAddOnly && permission != Permission.photosAddOnly &&
permission != Permission.reminders && permission != Permission.reminders &&
permission != Permission.bluetooth &&
permission != Permission.appTrackingTransparency && permission != Permission.appTrackingTransparency &&
permission != Permission.criticalAlerts; permission != Permission.criticalAlerts;
} }
......
...@@ -21,7 +21,15 @@ Future<bool> openAppSettings() => _handler.openAppSettings(); ...@@ -21,7 +21,15 @@ Future<bool> openAppSettings() => _handler.openAppSettings();
/// Actions that can be executed on a permission. /// Actions that can be executed on a permission.
extension PermissionActions on Permission { extension PermissionActions on Permission {
/// The current status of this permission. /// Checks the current status of the given [Permission].
///
/// Notes about specific permissions:
/// - **[Permission.bluetooth]**
/// - iOS 13.0 only:
/// - The method will **always** return [PermissionStatus.denied],
/// regardless of the actual status. For the actual permission state,
/// use [Permission.bluetooth.request]. Note that this will show a
/// permission dialog if the permission was not yet requested.
Future<PermissionStatus> get status => _handler.checkPermissionStatus(this); Future<PermissionStatus> get status => _handler.checkPermissionStatus(this);
/// If you should show a rationale for requesting permission. /// If you should show a rationale for requesting permission.
...@@ -78,7 +86,8 @@ extension PermissionCheckShortcuts on Permission { ...@@ -78,7 +86,8 @@ extension PermissionCheckShortcuts on Permission {
/// Actions that apply only to permissions that have an associated service. /// Actions that apply only to permissions that have an associated service.
extension ServicePermissionActions on PermissionWithService { extension ServicePermissionActions on PermissionWithService {
/// Checks the current status of the service associated with this permission. /// Checks the current status of the service associated with the given
/// [Permission].
/// ///
/// Notes about specific permissions: /// Notes about specific permissions:
/// - **[Permission.phone]** /// - **[Permission.phone]**
...@@ -98,6 +107,14 @@ extension ServicePermissionActions on PermissionWithService { ...@@ -98,6 +107,14 @@ extension ServicePermissionActions on PermissionWithService {
/// - **PLEASE NOTE that this is still not a perfect indication** of the /// - **PLEASE NOTE that this is still not a perfect indication** of the
/// device's capability to place & connect phone calls as it also depends /// device's capability to place & connect phone calls as it also depends
/// on the network condition. /// on the network condition.
/// - **[Permission.bluetooth]**
/// - iOS:
/// - The method will **always** return [ServiceStatus.disabled] when the
/// Bluetooth permission was denied by the user. It is impossible to
/// obtain the actual Bluetooth service status without having the
/// Bluetooth permission granted.
/// - The method will prompt the user for Bluetooth permission if the
/// permission was not yet requested.
Future<ServiceStatus> get serviceStatus => _handler.checkServiceStatus(this); Future<ServiceStatus> get serviceStatus => _handler.checkServiceStatus(this);
} }
......
...@@ -2,7 +2,7 @@ name: permission_handler ...@@ -2,7 +2,7 @@ name: permission_handler
description: Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions. description: Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.
repository: https://github.com/baseflow/flutter-permission-handler repository: https://github.com/baseflow/flutter-permission-handler
issue_tracker: https://github.com/Baseflow/flutter-permission-handler/issues issue_tracker: https://github.com/Baseflow/flutter-permission-handler/issues
version: 10.4.2 version: 10.4.3
environment: environment:
sdk: ">=2.15.0 <4.0.0" sdk: ">=2.15.0 <4.0.0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment