Baseflow / flutter-permission-handler

Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.
https://baseflow.com
MIT License
2.05k stars 861 forks source link

[Bug]: permissions is already running #1371

Open gghh0408 opened 3 months ago

gghh0408 commented 3 months ago

Please select affected platform(s)

Steps to reproduce

1.start to get the permission like camera. 2.cancle the permission dialog by gesture.(onrequestpermissionResult will not callback on this moment) 3.start to get the camera permission again. 4.bug happened.

Expected results

I tried to fix this, but I'm not sure if it will affect the others。

My modification plan like it↓:

private boolean isAbleToClearCount = false;

    @PermissionConstants.PermissionStatus
    private int determinePermissionStatus(final @PermissionConstants.PermissionGroup int permission) {
        if (isAbleToClearCount) {
            isAbleToClearCount = false;
            pendingRequestCount = 0;
        }

line 435:
       if (permissionsToRequest.size() > 0) {
            isAbleToClearCount = true;
            final String[] requestPermissions = permissionsToRequest.toArray(new String[0]);
            ActivityCompat.requestPermissions(
                    activity,
                    requestPermissions,
                    PermissionConstants.PERMISSION_CODE);
        }

Looking forward to your reply。

zzf0805 commented 1 month ago

same