From 5153c98cae2a5200a5e42bf06ddb0f68d28ca3e2 Mon Sep 17 00:00:00 2001 From: Markus Riegel Date: Mon, 7 Dec 2015 19:17:29 +0100 Subject: [PATCH] (impr) switch from void to firebase --- .../reactivefire/ReactiveFireCollection.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/reactivefire/src/main/java/com/marcorei/reactivefire/ReactiveFireCollection.java b/reactivefire/src/main/java/com/marcorei/reactivefire/ReactiveFireCollection.java index 6a27e07..8c7260b 100644 --- a/reactivefire/src/main/java/com/marcorei/reactivefire/ReactiveFireCollection.java +++ b/reactivefire/src/main/java/com/marcorei/reactivefire/ReactiveFireCollection.java @@ -117,10 +117,10 @@ public void call() { * @param Value type. * @return Void Observable. */ - public Observable setValue(final Firebase reference, final T value) { - return Observable.create(new Observable.OnSubscribe() { + public Observable setValue(final Firebase reference, final T value) { + return Observable.create(new Observable.OnSubscribe() { @Override - public void call(final Subscriber subscriber) { + public void call(final Subscriber subscriber) { reference.setValue(value, new ReactiveCompletionListener(subscriber)); // Can't remove complete listeners. } @@ -134,7 +134,7 @@ public void call(final Subscriber subscriber) { * @param Value type. * @return Void Observable. */ - public Observable pushValue(Firebase reference, T value) { + public Observable pushValue(Firebase reference, T value) { return setValue(reference.push(), value); } @@ -143,10 +143,10 @@ public Observable pushValue(Firebase reference, T value) { * @param reference Target location. * @return Void Observable. */ - public Observable removeValue(final Firebase reference) { - return Observable.create(new Observable.OnSubscribe() { + public Observable removeValue(final Firebase reference) { + return Observable.create(new Observable.OnSubscribe() { @Override - public void call(Subscriber subscriber) { + public void call(Subscriber subscriber) { reference.removeValue(new ReactiveCompletionListener(subscriber)); // Can't remove complete listeners. } @@ -224,9 +224,9 @@ public void onCancelled(FirebaseError firebaseError) { } private class ReactiveCompletionListener implements Firebase.CompletionListener { - private Subscriber subscriber; + private Subscriber subscriber; - public ReactiveCompletionListener(Subscriber subscriber) { + public ReactiveCompletionListener(Subscriber subscriber) { this.subscriber = subscriber; } @@ -236,6 +236,7 @@ public void onComplete(FirebaseError firebaseError, Firebase firebase) { subscriber.onError(firebaseError.toException()); } else { + subscriber.onNext(firebase); subscriber.onCompleted(); } }