Skip to content

PresentationModel.lifecycleObservable and untilDestroy. #52

@Jeevuz

Description

@Jeevuz

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions