onNeverAskAgain gets called when touch outside of permission dialog
Description
When the permission dialog pops up, if user touches outside of the permission dialog, it.anyPermanentlyDenied() returns true while user didn't pressed Don't ask again checkbox/
KPermissions version: 3.2.1
API level: 30
How to reproduce it:
- Ask for a permission with permission.send()
- After the dialog pops up, touch outside of the dialog's area
Sample code:
val p = permissionsBuilder(Manifest.permission.CAMERA)
.build()
.apply {
addListener {
when {
it.allGranted() -> {
Logger.d("askForPermission::onPermissionAccepted")
onPermissionAccepted()
}
it.anyShouldShowRationale() -> {
Logger.d("askForPermission::onShowRationale")
onShowRationale?.invoke()
}
it.anyPermanentlyDenied() -> {
Logger.d("askForPermission::onNeverAskAgain")
onNeverAskAgain?.invoke()
}
it.anyDenied() -> {
Logger.d("askForPermission::onPermissionDenied")
onPermissionDenied?.invoke()
}
}
}
}
p.send()
Thanks for submitting this issue. I'll investigate this and get back to you!
I still have not found any way to detect if the user denied the permissions permanently or clicked outside the dialog.
In both cases, shouldShowPermissionsRationale is false and the permissions are denied.
I'll continue to search for a solution, if anyone have an idea on how to identify those two events separately, it would be helpful.
@TurKurT656 In my opinion, I don't think this issue as a bug in this library.
The permission dialog is shown to the user by the Android OS. And this library or our code cannot manipulate it. So if the user is clicking outside the dialog & closing the dialog -> then its Android OS' behaviour.
@fondesa You may close this issue. 👍🏼 Btw, very good library!! ❤️ ❤️ ❤️
Closing this since as @RahulSDeshpande explained, this is the Android OS' behaviour, so it's probably better to not perform any workaround to enable this.