Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PresentationModel.lifecycleObservable and untilDestroy. #52

Open
Jeevuz opened this issue Nov 13, 2019 · 0 comments
Open

PresentationModel.lifecycleObservable and untilDestroy. #52

Jeevuz opened this issue Nov 13, 2019 · 0 comments

Comments

@Jeevuz
Copy link
Collaborator

Jeevuz commented Nov 13, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant