calling both on onSuccess() and onComplete() breaks MaybeObserver contract
m7mdyahia opened this issue · 1 comments
m7mdyahia commented
as stated in MaybeObserver contract
After a MaybeObserver calls a Maybe's subscribe method, first the Maybe calls onSubscribe(Disposable) with a Disposable that allows cancelling the sequence at any time, then the Maybe calls only one of the MaybeObserver's onSuccess(T), onError(java.lang.Throwable) or onComplete() methods to provide notifications.
so I suggest this should be
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
emitter.onSuccess(dataSnapshot);
} else {
emitter.onComplete();
}
}
FrangSierra commented
Totally right, if you want feel free to upload a PR with the changes in the Maybe
calls. If not, I will fix it in the next release.
Thank you so much for your feedback!