-
Notifications
You must be signed in to change notification settings - Fork 599
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
[Permissions] PermissionRequired switches to permissionNotAvailableContent when clicking outside of the permission request #549
Comments
This bug is a tricky one for multiple reasons:
I agree with you that the UX in this case is far from ideal. However, the system doesn't give us enough information to know the user hasn't interacted with the dialog. I'll ask members of the permissions team to see if there's a better way to handle this case. Thank you! |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
If keeping state across app restarts is possible, this would be solvable. Let's say we start in state A and
State A, B, and C could each show a different user-provided screen (or A and B the same one). In State C, no permission should be requested. If the permission is granted (either via a request or via the app settings), the state must be reset to state B, since as far as I'm concerned, the permission request dialog is shown only once after the user denies the permission through settings again. This is probably not in scope to implement, right? Maybe the user could be made responsible to manage the state. If so, not managing the state and getting the current behavior should be possible of course. Maybe via another set of composables. |
BTW, if you're interested in code: https://gist.github.com/fschuetz04/bde1bc46cfd914bdb25689ea5be40c7f. The |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
The issue with keeping some sort of persistent state across app restarts is that there's no guarantee that it stays in sync with the underlying state of the system, which could happen when denying or giving permission in the system settings, or if the user clears out app data locally. |
As far as my tests went, after denying in settings, the app is allowed to ask for permission once. So by setting the state to one request left whenever the permission is granted, this works out fine. When app data is cleared, the app is allowed to ask for permission twice again, so this works fine too. I tested this on Android 11, don't know if it is different on other versions. |
Ah, I see the importance of this block now:
This is admittedly unlikely, but does this handle the case where the state is I think in that situation the app would continue to show |
Great question, I did not think about this scenario. I mean it's not as critical, but still. I'll test it and get back. |
I got to check it now. As expected, this does not handle the case you described. The app is allowed to ask for permission once, but thinks it is not allowed to ask. Again, I don't think it's critical since it's a rare case and opening app settings works fine. I don't think there is any other way to handle this case, but please correct me if I'm wrong. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
Describe the bug
When using the
PermissionRequired
composable, it first showspermissionNotGrantedContent
. When callingpermissionState.launchPermissionRequest()
, the permission request is launched. If the user clicks onDeny
,permissionNotGrantedContent
is still shown. If the permission is requested again and the user clicks onDeny
again,permissionNotAvailableContent
is shown. If the user clicks outside of the permission request the first time,permissionNotAvailableContent
is shown immediately. In my opinion, this is inconsistent.To Reproduce
Example code:
Expected behavior
I would expect a different behavior. Either, clicking outside the request shows
permissionNotGrantedContent
, or denying the request immediately showspermissionNotAvailableContent
.Environment:
The text was updated successfully, but these errors were encountered: