Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle contacts limited permission #1395

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions permission_handler/lib/permission_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ extension PermissionCheckShortcuts on Permission {
/// *Only supported on iOS.*
Future<bool> 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<bool> get isLimited => status.isLimited;

/// Returns `true` when permissions are denied permanently.
Expand Down
4 changes: 4 additions & 0 deletions permission_handler_apple/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ + (PermissionStatus)permissionStatus {
return PermissionStatusPermanentlyDenied;
case CNAuthorizationStatusAuthorized:
return PermissionStatusGranted;
case CNAuthorizationStatusLimited:
return PermissionStatusLimited;
}

} else {
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion permission_handler_apple/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading