Skip to content

Instantly share code, notes, and snippets.

Last active Oct 28, 2022
What would you like to do?
One leak fixed
class ActivityPresenter @Inject constructor(
private val repository: SomeRepository
) : BasePresenter<ActivityView>() {
/* removed for brevity */
private val viewDisposable = CompositeDisposable()
override fun attachView(view: ActivityView?) {
val disposable = repository.doSomeHeavyWorkAndReturnState()
.subscribeOn( // send work to background thread
.observeOn(AndroidSchedulers.mainThread()) // return results to main thread
.subscribe { viewState.render(it) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment