Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Automatic lifecycle management #5

Open
chweez opened this issue Aug 30, 2017 · 8 comments
Open

Automatic lifecycle management #5

chweez opened this issue Aug 30, 2017 · 8 comments

Comments

@chweez
Copy link
Contributor

chweez commented Aug 30, 2017

For now, the user must call Tovuti.from(context).stop() but i want to make it automatic when the Activity/Fragment stops.
So, the way Glide implements this feature is by having a view-less Fragment. The view-less fragment is attached to the activity/fragment where the Monitor is attached and these Fragment receives the lifecycle events of the parent/host thus allowing the Monitor to respond accordingly without user intervention (i.e. calling stop method).
I'll try see if this way will suit us. The only problem is increasing the complexity of the library unnecessarily. What do you think @jumadeveloper?

@jumaallan
Copy link
Owner

Yes, having it kill or stop itself is a great idea, ping me if you need any help, but I can see you are doing great already!

@chweez
Copy link
Contributor Author

chweez commented Aug 30, 2017

Haha...thanks. Though I'll create another pull for the documentation...

@jumaallan
Copy link
Owner

Great

@chweez
Copy link
Contributor Author

chweez commented Sep 12, 2017

I've been considering this... @jumadeveloper help me with this... I'd like to hear your take on the matter. Any other perspective.

@jumaallan
Copy link
Owner

@chweez I think we should make it handle the lifecycle automatically, by somehow receiving the lifecycle event of the parent, as you had stated earlier when creating the issue to reduce code setup needed by the user

@jumaallan
Copy link
Owner

@chweez I have an idea, we can use livedata own lifecylcle manager, to manage our lifecylce here easily. Have a look at it and probably get back with ideas or suggestions

@chweez
Copy link
Contributor Author

chweez commented Oct 10, 2017

I've been looking at this. I have a concern for including the LiveData and LifecycleOwner from arch components because of the external dependencies. However, it may prove worth it. What I'm thinking is another module that depends on livedata and another that depends on rxjava. Adding the module dependency will pull in the transitive dependency to :networkmanager. The module names will be; :networkmanager-livedata and :networkmanager-rxjava

@jumaallan
Copy link
Owner

@chweez I completely agree with you

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

No branches or pull requests

2 participants