[go: up one dir, main page]

Skip to content

Commit

Permalink
Fix #242 and #303 by internally using ReplaySubject for intents
Browse files Browse the repository at this point in the history
  • Loading branch information
sockeqwe committed Mar 3, 2018
1 parent 3c8f8f8 commit 0b97c26
Show file tree
Hide file tree
Showing 12 changed files with 614 additions and 459 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ ext {
// Libraries
supportLibVersion = '27.0.2'
rxjava2Version = '2.0.7'
rxAndroid2Version = '2.0.1'


// Libraries for samples
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package com.hannesdorfmann.mosby3.mvi;

import io.reactivex.observers.DisposableObserver;
import io.reactivex.subjects.PublishSubject;
import io.reactivex.subjects.Subject;

/**
* Just a simple {@link DisposableObserver} that is used to cancel subscriptions from view's
Expand All @@ -29,21 +29,24 @@
*/
class DisposableIntentObserver<I> extends DisposableObserver<I> {

private final PublishSubject<I> subject;
private final Subject<I> subject;

public DisposableIntentObserver(PublishSubject<I> subject) {
this.subject = subject;
}
public DisposableIntentObserver(Subject<I> subject) {
this.subject = subject;
}

@Override public void onNext(I value) {
subject.onNext(value);
}
@Override
public void onNext(I value) {
subject.onNext(value);
}

@Override public void onError(Throwable e) {
throw new IllegalStateException("View intents must not throw errors", e);
}
@Override
public void onError(Throwable e) {
throw new IllegalStateException("View intents must not throw errors", e);
}

@Override public void onComplete() {
subject.onComplete();
}
@Override
public void onComplete() {
subject.onComplete();
}
}
Loading

0 comments on commit 0b97c26

Please sign in to comment.