ursus
02/14/2019, 5:31 AMfun logout() {
api.logout()
userDb.removeUser()
userPrefs.remove()
etc.
}
I've seen people do like
fun logout(): Single ... {
api.logoutSingle()
.flatmap { userDb.removeUserSingle() }
.flatmap { userSettings.removeSingle() }
}
or `andThen`s if Completable
To me this doesnt make sense, since its inherently sequential. If my Api returned singles, would it be criminal to use api.logout().blockingGet() and then sync. versions of the other 2 functions, and wrap it all in Single.fromCallable?
And also, in the flatmap chains I have to worry about atomicity. i.e. chain could be unsubbed half way and my settings wont get cleared etc. Having it single sync. function would prevent it