ViewModel unexpectedly re-emits the previous decision (deny) when running the fragment for the second time immediately after denying for the first time.
Setup:
constructPermissionsRequest with Camera permission in Fragment.onCreate()Deny callback is not triggered immediately on re-enter of fragment with permission.
Should be same behavior as reentering the Fragment after relaunching the app.
Deny callback is triggered immediately. And then
Rationale callback is called as well.
Since deny callback has been called, the fragment is already removed in the backstack.
If I proceed with the rationale and press the Deny again, it will call the on deny callback again.
Deny callback will be called twice in total.
If I re-launch the app fresh the deny callback will only be called on press of deny button.
I am trying to migrate my kapt permissions code into ktx, and encountered this issue (don't have this issue with kapt).
As for the fix, I think for fragments we should be passing the fragment as the lifecycle owner, and then observe with the Fragment.viewLifecycleOwner for the permissionRequestResult
let us check, thx!
The issue has been resolved in 1.0.1 I guess 馃檹 Let us know if it has not been addressed 馃檱
Let me close the issue.
Hello! I hadn't checked this in a while. Glad it's resolved! I'll update the version and confirm.