-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
Description
PresentationModel.lifecycleObservable won't emit the Lifecycle.DESTROYED if subscribed with added untilDestroy().
It is because of this part:
lifecycleObservable
.takeUntil { it == Lifecycle.DESTROYED }
.subscribe {
when (it) {
...
Lifecycle.DESTROYED -> {
compositeDestroy.clear()
onDestroy()
}
}
...lifecycleObservable calls the compositeDestroy.clear() and untilDestroy will unsubscribe the source, so our subscription won't get the DESTROYED.
Logically it's ok, but it makes lifecycleObservable less usable in practice. Think we need to change this to get DESTROYED before unsubscribing.