update support libs and small refactoring "until" method

This commit is contained in:
Alexander Bubnov 2017-03-28 10:43:26 +03:00
parent 0a0eb8685e
commit 5e41028b9f
2 changed files with 7 additions and 5 deletions

View File

@ -27,8 +27,8 @@ dependencies {
compile 'com.android.support:multidex:1.0.1'
compile 'io.reactivex:rxandroid:1.2.1'
provided 'com.android.support:appcompat-v7:25.3.0'
provided 'com.android.support:recyclerview-v7:25.3.0'
provided 'com.android.support:appcompat-v7:25.3.1'
provided 'com.android.support:recyclerview-v7:25.3.1'
provided 'com.squareup.retrofit2:retrofit:2.2.0'
provided('com.google.http-client:google-http-client-jackson2:1.22.0') {

View File

@ -260,7 +260,7 @@ public abstract class TouchinService<TLogic extends Logic> extends Service {
@NonNull final Action0 onCompletedAction) {
final Observable<T> actualObservable;
if (onNextAction == Actions.empty() && onErrorAction == (Action1) Actions.empty() && onCompletedAction == Actions.empty()) {
actualObservable = observable.doOnCompleted(onCompletedAction);
actualObservable = observable;
} else {
actualObservable = observable.observeOn(AndroidSchedulers.mainThread()).doOnCompleted(onCompletedAction);
}
@ -268,14 +268,16 @@ public abstract class TouchinService<TLogic extends Logic> extends Service {
return isCreatedSubject.first()
.switchMap(created -> created ? actualObservable : Observable.empty())
.takeUntil(conditionSubject.filter(condition -> condition))
.subscribe(onNextAction, throwable -> {
.doOnNext(onNextAction)
.doOnError(throwable -> {
final boolean isRxError = throwable instanceof OnErrorThrowable;
if ((!isRxError && throwable instanceof RuntimeException)
|| (isRxError && throwable.getCause() instanceof RuntimeException)) {
Lc.assertion(throwable);
}
onErrorAction.call(throwable);
});
})
.subscribe();
}
@SuppressWarnings("CPD-END")