sparrowcode / PermissionsKit

Universal API for request permission and get its statuses.
https://x.com/sparrowcode_ios
MIT License
5.64k stars 462 forks source link

Support undetermined value #179

Closed alpdigitech closed 4 years ago

alpdigitech commented 4 years ago

Apple docs says that user preference must be respected. For example if user disallows location then it cannot be used anymore, like geolocating a snapped photo. The problem is on app launch I can only check for isDenied or isAllowed and seeing isDenied, the code always prompts the user. I'd like only to prompt if isUndetermined, i.e. no explicit answer yet from the user. If user denies initially then it should be respected and should not be prompted anymore in succeeding runs especially if the app can run without that particular permission.

ivanvorobei commented 4 years ago

I can add it because not each permission allow check isUndetermined status. You can check manually it by CCLocationManager

alpdigitech commented 4 years ago

Yeah I actually used CCLocationManager but it would have been cleaner if SPPermissions supports it. For libraries thad have undetermined status isUndetermined() can return true or false and for those that don't have it then isUndetermined() always returns false since isAllowed() or isDenied() is always set. Anyways thanks and more power.