Improve comment of permanentlyDenied
After I updated the lib I noticed that my UI was always displaying that the permission has been denied. After trying to find out why, I realized that the .undetermined value in the PermissionStatus enum was removed. In the changelog it says it was replaced with .denied. I was trying to find a way to have my implementation working as before, but looking at the code, apparently there was no way to do that. Because how do you differentiate denied when not determined, from denied after user explicitly denied it. Looking at the issues I found a comment that helped me find a solution:
On iOS when the user explicitly denies permissions the plugin will always return permanentlyDenied. On Android the plugin will return permanentlyDenied when the user selects the "Don't ask again" checkbox (pre API 30) or when the user denied permissions for a second time in a row (API 30 and higher).
Originally posted by @mvanbeusekom in https://github.com/Baseflow/flutter-permission-handler/issues/493#issuecomment-801851287
What caused me this confusion is that on the PermissionStatus enum, the .permanentlyDenied value, says it is only supported on Android, when in reality it actually is not. https://github.com/Baseflow/flutter-permission-handler/blob/d1b162e28306ba2958c4f8a1cfb57ff82864f4bf/permission_handler_platform_interface/lib/src/permission_status.dart#L24
As it seems, I should use now .denied as if it was not determined and .permanentlyDenied as the old .denied. Is that correct? If that is the case, I believe the comment should be improved.
Hi @leonardosilva-asaas,
That is correct the .undetermined status has been replaced by the .denied permission on iOS and after the user explicitly denied permission the permission_handler will indeed return the .permanentlyDenied status.
The API documentation is indeed not correct here and should be updated. Thanks for pointing this out, I will leave this issue open so we can track the progress on the documentation update.
Closing this issue, as the comment seems to have been updated already: https://github.com/Baseflow/flutter-permission-handler/blob/main/permission_handler_platform_interface/lib/src/permission_status.dart