Skip to content

Instantly share code, notes, and snippets.

@ahinchman1
Last active Oct 28, 2022
Embed
What would you like to do?
ActivityPresenter with two leaks
class ActivityPresenter @Inject constructor(
private val repository: SomeRepository
) : BasePresenter<ActivityView>() {
/* removed for brevity */
private val viewDisposable = CompositeDisposable()
override fun attachView(view: ActivityView?) {
super.attachView(view)
val disposable = repository.doSomeHeavyWorkAndReturnState()
.subscribeOn(Schedulers.io())
.subscribe { viewState.render(it) }
viewDisposable.add(disposable)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment