I am following MVVM
architecture for my app. In Activity I need to getNews()
from a URL, if news is not already cached.
Activity will ask ViewModel
to give the News Json
and ViewModel
will look into the repository, and decide to send data from local or remote repository.
Now the confusion stems from the following point: Should I create a separate Repository class for each Activity, or a general Repository class for the entire project with which each activity communicates. The repository class would be huge in the second approach.
I am unable to find out any official guideline on this topic, and I would like to know the best practice on this regard.