Created
September 10, 2017 10:04
-
-
Save charlag/b07eeef5413f2f69eef4533fb03eedbd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val showToast: Observable<Unit> | |
//... | |
val showToastSubject = PublishSubject.create<Unit>() | |
showToast = showToastSubject | |
val errorEffect = ObservableTransformer<Triple<State, State, Event>, Event> { upstream -> | |
upstream.ofEventType<ServerResponseEvent>.switchMap { (_, _, event) → | |
if (!event.isSuccessful) showToastSubject.onNext(Unit) | |
Observable.empty() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment