flutter-permission-handler icon indicating copy to clipboard operation
flutter-permission-handler copied to clipboard

Correct doc for permanentlyDenied status

Open britov opened this issue 3 years ago • 3 comments

🚀 Feature Requests

permanentlyDenied maybe on ios in case when user disallow permissions in the OS setting. In this case .request() open Settings for your app image

Contextualize the feature

Describe the feature

Edit doc for permanentlyDenied status in source, remove line /// *Only supported on Android.*

Platforms affected (mark all that apply)

  • [x] :iphone: iOS
  • [ ] :robot: Android

britov avatar Dec 03 '21 15:12 britov

I got the same problem but the .request() method is not calling settings automatically.

josechagas avatar Jan 07 '22 11:01 josechagas

ok, disregard what is written underneath, it is all described here in the Wiki https://github.com/Baseflow/flutter-permission-handler/wiki/Changes-in-6.0.0#breaking-changes


I would like to suggest adding to docs (in your own words) that it is wrong to expect that a call to Permission.xxxxx.status will return PermissionStatus.isPermanentlyDenied after the permission was set to "Don't allow" or permanentlyDenied. Instead, it returns PermissionStatus.denied and it is necessary to know if the app is returning from the openAppSettings call (i.e. Settings screen) to set the permission to what it really is.

Something along these lines:

bool hasOpenedAppSettings = openAppSettings();
// opens Settings or App Settings screen
...
// return to app from Settings screen
var permissionStatus = Permission.xxxxx.status;
if (hasOpenedAppSettings && permissionStatus.isDenied) {
  permissionStatus = PermissionStatus.permanentlyDenied;
}

Please correct me if I'm wrong, maybe my approach was wrong from the start. I've lost a great deal of time on the assumption that permanentlyDenied will be returned and I remembered, way too late, that I read somewhere that this is the case. If I find the source, I will amend it to this comment.

markfili avatar Jan 25 '22 12:01 markfili

I also found this doc misleading. I read the doc and understood that PermissionStatus.permanentlyDenied will never happen on iOS.

I am using this library v8.1.6. But, I get status=PermissionStatus.permanentlyDenied on my iOS 15 device.

I checked iOS code, and found a case when it returns PermissionStatus.permanentlyDenied. https://github.com/Baseflow/flutter-permission-handler/blob/634b29bf03faf4431fd4bf535eb03eb0d10a6c53/permission_handler/ios/Classes/strategies/ContactPermissionStrategy.m#L45

cynw avatar Feb 14 '22 15:02 cynw

Closing, as it seems to be a duplicate of #826.

JeroenWeener avatar Aug 29 '23 11:08 JeroenWeener