diff --git a/permission_handler/lib/permission_handler.dart b/permission_handler/lib/permission_handler.dart index 31db1936e..4025997eb 100644 --- a/permission_handler/lib/permission_handler.dart +++ b/permission_handler/lib/permission_handler.dart @@ -140,8 +140,8 @@ extension PermissionCheckShortcuts on Permission { /// *Only supported on iOS.* Future get isRestricted => status.isRestricted; - /// User has authorized this application for limited photo library access. - /// *Only supported on iOS.(iOS14+)* + /// User has authorized this application for limited access. + /// *Only supported on iOS.(iOS14+ for photos, ios18+ for contacts)* Future get isLimited => status.isLimited; /// Returns `true` when permissions are denied permanently. diff --git a/permission_handler_apple/CHANGELOG.md b/permission_handler_apple/CHANGELOG.md index 05dd219d7..20a65108a 100644 --- a/permission_handler_apple/CHANGELOG.md +++ b/permission_handler_apple/CHANGELOG.md @@ -1,3 +1,7 @@ +## 9.4.6 + +* Adds the ability to handle `CNAuthorizationStatusLimited` introduced in ios18 + ## 9.4.5 * Fixes issue #1002, Xcode warning of the unresponsive of main thread when checking isLocationEnabled. diff --git a/permission_handler_apple/ios/Classes/strategies/ContactPermissionStrategy.m b/permission_handler_apple/ios/Classes/strategies/ContactPermissionStrategy.m index 67b45b4ad..37ff452d0 100644 --- a/permission_handler_apple/ios/Classes/strategies/ContactPermissionStrategy.m +++ b/permission_handler_apple/ios/Classes/strategies/ContactPermissionStrategy.m @@ -45,6 +45,8 @@ + (PermissionStatus)permissionStatus { return PermissionStatusPermanentlyDenied; case CNAuthorizationStatusAuthorized: return PermissionStatusGranted; + case CNAuthorizationStatusLimited: + return PermissionStatusLimited; } } else { @@ -73,7 +75,8 @@ + (void)requestPermissionsFromContactStore:(PermissionStatusHandler)completionHa [contactStore requestAccessForEntityType:CNEntityTypeContacts completionHandler:^(BOOL granted, NSError *__nullable error) { if (granted) { - completionHandler(PermissionStatusGranted); + const PermissionStatus updatedStatus = [self permissionStatus]; + completionHandler(updatedStatus); } else { completionHandler(PermissionStatusPermanentlyDenied); } diff --git a/permission_handler_apple/pubspec.yaml b/permission_handler_apple/pubspec.yaml index ef6679c56..c0a3fb49f 100644 --- a/permission_handler_apple/pubspec.yaml +++ b/permission_handler_apple/pubspec.yaml @@ -2,7 +2,7 @@ name: permission_handler_apple description: Permission plugin for Flutter. This plugin provides the iOS API to request and check permissions. repository: https://github.com/baseflow/flutter-permission-handler issue_tracker: https://github.com/Baseflow/flutter-permission-handler/issues -version: 9.4.5 +version: 9.4.6 environment: sdk: ">=2.15.0 <4.0.0"