Hey, I started to work with Room, first time thoug...
# android-architecture
Hey, I started to work with Room, first time though, and I'm used to use the Repository pattern and it comes from an usecase, the thing is that I always did an api call, so my usecase called a repository that contains my service, but now, first I want to check : if there's internet connection, if there's not, call the repository from room, and if there is internet connection call the repository from service, do I have to put both on the constructor? I mean, how would be the flow? Presenter sends find X --> I have an use case to find it --> I have a repository to get it from there So, the thing is where I have to do the check for internet connection and if it's a or b do some action? Let's say, should be : UI: User type name of the cat UI -> Presenter with the name of the cat Presenter -> Have an use case that it's GetCatUseCase that I have to put a parameter that it's the name GetCatUseCase -> On my old projects I just call the service, but now sometimes I'll have to call the repository from roomdb and other repository from service... Any ideas how to organize it?
if u follow the suggested method then single source of truth is your repository. it can contain more sources, network & local. then in your repository call u can decide which source should be called