Created
October 9, 2018 18:45
-
-
Save mayojava/bbfe94ae527e77e9fe36a9ebf75a1652 to your computer and use it in GitHub Desktop.
RxJava implementation of show user orders
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
fun showUserOrders(username: String, password: String) { | |
login(username, password) | |
.flatMap { user -> fetchUserOrders(user.userId) } | |
.subscribeOn(Schedulers.io()) | |
.observeOn(AndroidSchedulers.mainThread()) | |
.subscribe { showOrders(it) } | |
} | |
fun login(username: String, password: String): Single<User> | |
fun fetchUserOrders(userId: Long): Single<List<Orders>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment