Here's an example scenario:
I have an activity (view) and a presenter for that view. The presenter fetches a list of users from a network API and holds it in memory using a List object. The activity contains different types of fragments to display the content about the users based on User.type. The two fragments (UserType1Fragment and UserType2Fragment) have their own respective presenters too.
The activity's presenter decides what type (I or II) of fragment is shown next based. The fragments' presenters decide how the user object is displayed and handle a button click event called killUser(). This should update the List object in the activity's presenter.
This is where the problem lies:
How do the fragment presents have a reference to the data in activity presenter? The presenters shouldn't directly communicate with each other. Maybe I should abstract out the List into a repository/interactor? How would the List be shared among presenters?
Aucun commentaire:
Enregistrer un commentaire