tbruyelle/RxPermissions

Result is lost after Denying (DNKA on)

Closed this issue · 5 comments

Hello,

Looks like there is one more issue, when the result of permission request is lost. Steps to reproduce it with the sample app:

  1. Turn "Do not keep activities" on.
  2. Open the sample app, press "Enable camera".
  3. See the permission request dialog, don't press anything.
  4. Fold the app up.
  5. Retrieve the app from the recent apps.
  6. Click "Deny" (don't check "Never ask again").
  7. Press "Enable camera" again.
    Expected result: Permission request is done again, system dialog shown.
    Actual result: Nothing happens.

This one did I not observe in the 0.5.x version.

Looks like problem has appeared due to some changes in the null publish subjects handling. When I changed the part of request_() method (lines 193-205) to the following, the bug stopped to appear:

PublishSubject<Permission> subject = mSubjects.get(permission);
            // Request the permission to the framework only if not already done
            // and if there's no request without result (occurs on configuration
            // change, see onDestroy method).
            if (subject == null) {                                           // sic!
                unrequestedPermissions.add(permission);
            }

            // Create a new subject if not exists
            if (subject == null || subject.hasCompleted()) {    // sic!
                subject = PublishSubject.create();
                mSubjects.put(permission, subject);
            }

This is actually how it was in one of the previous versions (to be precise, before the commit e205f9d). I'm not sure, however, if such a change would now have any side-effects.

Maybe it would be helpful.

I fixed the issue, can you check if it's ok with the HEAD version ?

Does not reproduce now with the steps above.
Thank you!

Awesome thanks !

this problem is back in master. just checked out sources, switched to branch 2.x and was able to reproduce it with sample app on Nexus 6P running 7.1.2.

what i noticed, that with "don't keep activities" enabled, when app is put into background, then onDestroy() method of RxPermissionsFragment is being called. It's not called when phone is being rotated ...

was able to reproduce on emulator running 6.0