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

Support for reactive API #332

Closed
ww2lin opened this issue May 15, 2019 · 4 comments
Closed

Support for reactive API #332

ww2lin opened this issue May 15, 2019 · 4 comments

Comments

@ww2lin
Copy link

ww2lin commented May 15, 2019

Having an api that is "life-cycle" aware. where instead of closing the scopes manually within onDestroy in Android. We should be able to observeOn the events from TP. E.g OnInjection, OnOpenScope, OnClosingScope, OnClosedScope etc.

TP should be able to observe on a subject(one example is I'm thinking of is android LifeCycleOwner myLifecycleOwner.getLifecycle().addObserver(ToothPickObserver()); which then TP will know when to open/close scope.

@stephanenicolas
Copy link
Owner

stephanenicolas commented May 15, 2019 via email

@ww2lin
Copy link
Author

ww2lin commented May 15, 2019

@stephanenicolas Sorry my wording is a little bit confusing, I reword the description.

@stephanenicolas
Copy link
Owner

@ww2lin , Hey Alex. It could be an interesting idea. We definitely would have to add this to smoothie-androidx module. IIRC, view models also provide a life cycle observer when the view model is destroyed, this could be used to shutdown what we often refer to as presenter scopes.

If you feel like contributing it to TP, it would be great.

I would suggest that you would create a listener of lifecycle that would take both a scope and a lifecycleowner in constructor param, the listener would close the scope.

@stephanenicolas stephanenicolas mentioned this issue Jun 28, 2019
19 tasks
@stephanenicolas
Copy link
Owner

This has been released as part of TP 3.x. Have a look at the smoothie-lifecycle modules.

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

No branches or pull requests

2 participants