tbruyelle/RxPermissions

onNext() is not called after "deny" clicked

fierce-bunny opened this issue · 4 comments

Hi! I may be doing something wrong but rxPermissions.ensureEach() (or any other RxPermissions method) doesn't emit any event if I click "deny" or "deny & don't ask again" on a permission dialog. The permission dialog is not shown after that when I click the button again. Though it is shown after resubscribing.
Thanks

view.onChangePhotoClick()
            .compose(rxPermissions.ensureEach(Manifest.permission.CAMERA))
            .observeOn(schedulersProvider.ui())
            .subscribe ({ permission ->
                if (permission.granted) {
                    view.onCameraPermissionGranted()
                }
            }, Timber::e)

Android 10

Lib Version

0.12

I have the same issue. Were you able to solve this?

@andreii-sp Nope, just stopped using the lib in favour of another solution.

If you press the home button when applying for permission, you will not be able to apply for permission when re-entering the APP

If you press the home button when applying for permission, you will not be able to apply for permission when re-entering the APP.
modify:void onRequestPermissionsResult(String[] permissions, int[] grantResults, boolean[] shouldShowRequestPermissionRationale) {
if (permissions == null || permissions.length == 0) {
for (String key : mSubjects.keySet()) {
mSubjects.get(key).onNext(new Permission(key, false, shouldShowRequestPermissionRationale(key)));
mSubjects.get(key).onComplete();
}
mSubjects.clear();
return;
}
for (int i = 0, size = permissions.length; i < size; i++) {
MyLogger.d("onRequestPermissionsResult " + permissions[i]);
// Find the corresponding subject
PublishSubject subject = mSubjects.get(permissions[i]);
if (subject == null) {
// No subject found
Log.e(RxPermissions.TAG, "RxPermissions.onRequestPermissionsResult invoked but didn't find the corresponding permission request.");
return;
}
mSubjects.remove(permissions[i]);
boolean granted = grantResults[i] == PackageManager.PERMISSION_GRANTED;
subject.onNext(new Permission(permissions[i], granted, shouldShowRequestPermissionRationale[i]));
subject.onComplete();
}
}