Callback is called if you call runWithPremissions twice
Closed this issue · 6 comments
Hi there. I ran into an issue.
After revoking the permission from app settings screen I can't get to the system permission dialog anymore. The lib automatically calls callback function even though permission is not allowed.
Here is the code:
runWithPermissions(permission,
options = QuickPermissionsOptions(
handlePermanentlyDenied = true,
handleRationale = true,
permanentDeniedMethod = { denyFunction.invoke() },
permissionsDeniedMethod = { denyFunction.invoke() },
rationaleMethod = {
// We call this since on permission denied is not called
denyFunction.invoke()
}),
callback = { Timber.d("Permission callback") })
One extra information. I found a bug in my logic which caused this issue.
runWithPermissions
method from my previous comment was called twice in a row. The end behaviour was that I would get the system permission dialog but at the same time the callback function would execute.
Hi @mariciv . So your issue is resolved now? Or you are still facing some unexpected behavior?
@kirtan403 I was able to resolve my issue, but I think library could handle this case a bit better.
So if runWithPermissions
method is called twice, before user denies or allows permission in the system dialog, action callback shouldn't be called.
I've edited the title so it better reflects the real issue.
Thanks, @mariciv . Actually it works on the singleton objects for the requests and response. That's why that happened. I'll add this to the enhancement. Thanks for making things clear 😄
New version released with fix: https://github.com/QuickPermissions/QuickPermissions-Kotlin/releases/tag/0.4.0