public Observable<SoftwareUpdateData> refresh() { Observable<SoftwareUpdateData> observable; if (features.useNewApi()) { observable = updateHandler .triggerUpdateCheck() .flatMap( new Func1<Boolean, Observable<SoftwareUpdateData>>() { @Override public Observable<SoftwareUpdateData> call(Boolean aBoolean) { return softwareUpdate(); } }); } else observable = softwareUpdateObservable3(); return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()); }
public Observable<SoftwareUpdateData> makeUpdate() { Observable<SoftwareUpdateData> observable = updateHandler .triggerUpdate() .flatMap( new Func1<Boolean, Observable<SoftwareUpdateData>>() { @Override public Observable<SoftwareUpdateData> call(Boolean ignored) { return refresh(); } }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .share(); observable.onErrorResumeNext(Observable.<SoftwareUpdateData>empty()).subscribe(); return observable; }