Dagger 2 fragments with different scope

180 Views Asked by At

Is it possible to have two fragments from different scope in same activity where activity is in same scope as one of the fragments. I wrote sample code here (https://github.com/damirmiljkovic/daggerimplementation) which you can check it out.

What I am trying to achieve is to have single activity with multiple fragments, login fragment and user fragment. I have identity url for user authentication and after user is successfully authenticated API will return base URL for rest of the APIs. Now I have 2 retrofit instances, one is created on application creation and second one is created after user logs in. So activity and login fragment are within one scope(let's say @Singelton) and user fragment is with in other scope(let's say @UserScope). I need to get user details from API right after user logs in and if some conditions are not met I open user fragment so user can fill missing details.

0

There are 0 best solutions below