Skip to content

Commit

Permalink
upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
longhanhee committed Sep 23, 2021
1 parent a6a1e3c commit dfbc170
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions app/src/main/java/com/yoyiyi/soleil/rx/RxUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

import io.reactivex.BackpressureStrategy;
import io.reactivex.Flowable;
import io.reactivex.FlowableEmitter;
import io.reactivex.FlowableOnSubscribe;
import io.reactivex.FlowableTransformer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Function;
Expand Down Expand Up @@ -41,12 +43,15 @@ public static <T> FlowableTransformer<T, T> rxSchedulerHelper() { //compose
* @return
*/
public static <T> Flowable<T> createData(final T t) {
return Flowable.create(emitter -> {
try {
emitter.onNext(t);
emitter.onComplete();
} catch (Exception e) {
emitter.onError(e);
return Flowable.create(new FlowableOnSubscribe<T>() {
@Override
public void subscribe(@NonNull FlowableEmitter<T> emitter) throws Exception {
try {
emitter.onNext(t);
emitter.onComplete();
} catch (Exception e) {
emitter.onError(e);
}
}
}, BackpressureStrategy.BUFFER);
}
Expand Down

0 comments on commit dfbc170

Please sign in to comment.