we hope "get permission" will print once,but actually, it print twice!!
analysis
I find code in RxPermissions#request(trigger, permissions) , the oneOf method return Observable.merge
if Observable.merge contain two Observable , the requestImplementation method will execuate twice, finally the callback in subscribe will execuate twice!
so ,when the Observable.merge contains two Observable?
in most of time , pending method will return Observable.empty() , then wrapped by Observable.merge(trigger, Observable.empty()), the result just contains oneObservable.But with the code above, the pedding method will return Observable.just(TRIGGER), so the Observable.merge contains two Observable.
solution
I searched the history of those code, this related to #44 and #42 , but, when RxPermissionsFragment#onRequestPermissionsResult callback, mSubjects will remove all permissions.
code
guess with this code , what will print?
we hope "get permission" will print once,but actually, it print
twice
!!analysis
I find code in
RxPermissions#request(trigger, permissions)
, theoneOf
method returnObservable.merge
if
Observable.merge
contain twoObservable
, therequestImplementation
method will execuate twice, finally the callback in subscribe will execuate twice!so ,when the
Observable.merge
contains twoObservable
?in most of time ,
pending
method will returnObservable.empty()
, then wrapped byObservable.merge(trigger, Observable.empty())
, the result just contains oneObservable
.But with the code above, thepedding
method will returnObservable.just(TRIGGER)
, so theObservable.merge
contains twoObservable
.solution
I searched the history of those code, this related to #44 and #42 , but, when
RxPermissionsFragment#onRequestPermissionsResult
callback,mSubjects
will remove allpermissions
.so , the
pending
andoneOf
is out of date.just delete those code.