ResubscriptionObserver in MVP
Closed this issue · 2 comments
Does the ResubscriptionObserver
with @AutoResubscribe
have to be inside the activity or can I put it somewhere else like into the Presenter
?
I am injecting the GroupLifecycleManager
into the presenter to use it and of course calling the life cycle methods inside the activity.
You can put it in any class, the Presenter
would be a fine option.
You just have to make sure to call groupLifecycleManager.subscribe(presenter)
so that the manager knows where to look for the @AutoResubscribe
annotations and observers.
A pattern we use is to pass a manager to a helper class via its constructor, and then inside the class's constructor we save the manager to a field and do groupLifecycleManager.subscribe(this)
.
Thank you for the fast reply. Maybe its a good idea to add this to the readme 👍 works like charm