1
0
Fork 0

For #2502 - Moves the thread dance to where we update the view

Co-Authored-By: Christian Sadilek <csadilek@users.noreply.github.com>
master
Jeff Boek 2019-05-15 10:17:37 -07:00 committed by Christian Sadilek
parent 0b7df74731
commit 1404da92bd
1 changed files with 7 additions and 3 deletions

View File

@ -38,7 +38,13 @@ abstract class UIComponent<S : ViewState, A : Action, C : Change>(
val viewModel = viewModelProvider.fetchViewModel()
compositeDisposable.add(changesObservable.subscribe(viewModel.changes::onNext))
compositeDisposable.add(viewModel.state.subscribe(uiView.updateView()))
compositeDisposable.add(
viewModel
.state
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(uiView.updateView())
)
return compositeDisposable
}
@ -61,8 +67,6 @@ abstract class UIComponentViewModelBase<S : ViewState, C : Change>(
.withLatestFrom(_state)
.map { reducer(it.second, it.first) }
.distinctUntilChanged()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(_state)
}
}