Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

onNext() is not called after "deny" clicked #337

Open
fierce-bunny opened this issue Oct 29, 2020 · 4 comments
Open

onNext() is not called after "deny" clicked #337

fierce-bunny opened this issue Oct 29, 2020 · 4 comments

Comments

@fierce-bunny
Copy link

fierce-bunny commented Oct 29, 2020

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

@fierce-bunny fierce-bunny changed the title Bug onNext() is not called after "deny" clicked Oct 29, 2020
@andreii-sp
Copy link

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

@fierce-bunny
Copy link
Author

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

@weiwangshuai
Copy link

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

@weiwangshuai
Copy link

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();
}
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants