stojan
05/07/2020, 8:23 PMprivate fun useCase(): IO<Unit> = IO.fx {
effect { render(ViewState.Loading) }.bind()
continueOn(IO.dispatchers().io())
val model = effect { service.getModel() }.bind()
continueOn(Dispatchers.Main)
effect { render(ViewState.Content(model)) }.bind()
}.handleErrorWith {
IO.unit.continueOn(Dispatchers.Main)
.followedBy(IO.effect { render(ViewState.Error(it.message ?: "Ooops!")) })
}
any better way to make sure render(ViewState.Error(it.message ?: "Ooops!")) is called on the main thread on Android? 🤔