In Android presenter code, I see something like this, where
isFetching
is a class variable which holds network data fetching state.
Is this a good pattern? I was trying to remove this class variable to reduce state in presenter. Is that possible or will it be an overkill?
You might want to read about mvp with clean architecture. Presenter is not a right place to do fetching data. Presenter should be independent to android framework. It can get dâta from model layer. For more details you can pm me we could discuss
b
BMG
05/04/2020, 7:16 AM
@KayCee In Presenter, I'm not using any android component. It is completely independent from Android framework code..
view
is an interface implemented by Activity/fragment.
k
KayCee
05/04/2020, 7:50 AM
so in your presenter constructor, you have a reference of
apiService
? The main thing is you do the fetching job in presenter, why?
b
BMG
05/04/2020, 9:26 AM
No no, this was just an example. Presenter has Repository and repository takes care of loading from local or remote store..