-
Notifications
You must be signed in to change notification settings - Fork 605
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] MutableMultiplePermissionsState.shouldShowRationale
returns true despite some permissions being Denied(shouldShowRationale=false)
#1781
Comments
That does make sense. PR's welcome! |
…`MutableMultiplePermissionsState.shouldShowRationale` `launchMultiplePermissionRequest` is typically called when `shouldShowRationale` returns true. However, what may not be as obvious is that `launchMultiplePermissionRequest` appears to result in a noop if one or more permissions in `MutableMultiplePermissionsState` are `Denied(shouldShowRationale=false)`. This caused issues for us in some code similar to this: ```kotlin val permissions = rememberMultiplePermissionsState( listOf( ACCESS_FINE_LOCATION, ACCESS_BACKGROUND_LOCATION, ) ) when { // Granted permissions.allPermissionsGranted -> /* ... */, // Denied, but I can ask the user permissions.shouldShowRationale -> // UNEXPECTED: Does not trigger! permissions.launchMultiplePermissionRequest() // Denied and I may not ask the user. else -> /* ... */ } ``` The fix would seem to be to additionally make sure that there are no permissions with the `Denied(shouldShowRationale=false)` status before returning a truthy value from `shouldShowRationale`.
I'm also having this issue |
However I have issue with this in which shouldShowRationale is never being trigger even I already click don't allow. Check report bugs I have made. |
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. |
@bentrengrove as far as I know this has not yet been resolved? Could you please reopen? |
…`MutableMultiplePermissionsState.shouldShowRationale` `launchMultiplePermissionRequest` is typically called when `shouldShowRationale` returns true. However, what may not be as obvious is that `launchMultiplePermissionRequest` appears to result in a noop if one or more permissions in `MutableMultiplePermissionsState` are `Denied(shouldShowRationale=false)`. This caused issues for us in some code similar to this: ```kotlin val permissions = rememberMultiplePermissionsState( listOf( ACCESS_FINE_LOCATION, ACCESS_BACKGROUND_LOCATION, ) ) when { // Granted permissions.allPermissionsGranted -> /* ... */, // Denied, but I can ask the user permissions.shouldShowRationale -> // UNEXPECTED: Does not trigger! permissions.launchMultiplePermissionRequest() // Denied and I may not ask the user. else -> /* ... */ } ``` The fix would seem to be to additionally make sure that there are no permissions with the `Denied(shouldShowRationale=false)` status before returning a truthy value from `shouldShowRationale`.
[Permissions] fix(gh-1781): check for `Denied(shouldShowRationale=false)` in `MutableMultiplePermissionsState.shouldShowRationale`
Description
The current implementation of
MutableMultiplePermissionsState.shouldShowRationale
does not consider cases where one or more permissions areDenied(shouldShowRationale=false)
. This causes issues in statements such asThe issue is located at
accompanist/permissions/src/main/java/com/google/accompanist/permissions/MutableMultiplePermissionsState.kt
Line 130 in 57907e1
Suggested fix:
The text was updated successfully, but these errors were encountered: