Peko icon indicating copy to clipboard operation
Peko copied to clipboard

DeniedPermanently triggered when clicking outside of permissions dialog

Open a0g83agbc84 opened this issue 2 years ago • 4 comments

Hey,

When the user does not click on any button of the Android native request dialog but outside, the dialog gets dismissed and Peko triggers the PermissionResult.Denied.DeniedPermanently result. I think in this case PermissionResult.Cancelled should be called. The native dialog is triggered on next Activity execution despite Peko's PermissionResult.Denied.DeniedPermanently result.

Compile SDK: 33 Android version: 13

CoroutineScope(Default).launch {
            val result = requestPermissionsAsync(
                Manifest.permission.ACCESS_COARSE_LOCATION,
                Manifest.permission.ACCESS_FINE_LOCATION
            )

            when (result) {
                is PermissionResult.Granted -> {Log.e("Activity", "GRANTED") } // woohoo, all requested permissions granted
                is PermissionResult.Denied.JustDenied -> {Log.e("Activity", "JUST DENIED") } // at least one permission was denied, maybe we forgot to register it in the AndroidManifest?
                is PermissionResult.Denied.NeedsRationale -> {Log.e("Activity", "NEEDS") } // user clicked Deny, let's show a rationale
                is PermissionResult.Denied.DeniedPermanently -> { Log.e("Activity", "DENIED PERM")} // Android System won't show Permission dialog anymore, let's tell the user we can't proceed
                is PermissionResult.Cancelled -> {Log.e("Activity", "CANCELLED") } // interaction was interrupted
            }
        }

a0g83agbc84 avatar Sep 19 '22 09:09 a0g83agbc84

Thanks for reporting this, I found the problem. Will rollout a fix in the next few days.

deva666 avatar Sep 26 '22 15:09 deva666

@deva666 Has this been fixed already in the latest version? 🙏

toby-thanathip avatar Oct 27 '22 06:10 toby-thanathip

No, the idea I had to fix this is not working. Honestly, not sure if it is even possible to detect when user cancels a dialog. Since it is a Android System Dialog. Any help/suggestions are welcome here.

deva666 avatar Oct 27 '22 07:10 deva666

Same problem, no solution yet https://stackoverflow.com/questions/69658964/how-to-distinguish-never-ask-again-state-and-canceled-state-for-android-runt

deva666 avatar Nov 01 '22 10:11 deva666