Paul Woitaschek
11/19/2018, 5:27 PMPaul Woitaschek
11/21/2018, 2:02 PMRecipeComponent
. Now this recipe component needs to depend on dependencies from my AppComponent
.
So far - fine, no problems.
Now in my App I want to show a RecipeOverviewFragment
, so my app needs to have a dependency on the recipe
dagger module.
How do you overcome this circularity?Paul Woitaschek
11/21/2018, 2:03 PMRecipeComponent
not depend on the AppComponent
but rather expose all it's dependencies through a `bindsInstance' method.
But there are like 10 of them so this scales not too well.Paul Woitaschek
11/21/2018, 2:04 PMDavid
11/21/2018, 2:22 PM@BindsInstance
you allude to) but in the cases where I am modularising I am never binding anything more than Context
to a child module as part of the @dagger.Component
construction.David
11/21/2018, 2:24 PMapp
and recipe
(gradle) modules have a dependency on the this base component?David
11/21/2018, 2:25 PMDavid
11/21/2018, 2:26 PM@ApplicationScope
or `@Singleton`….David
11/21/2018, 2:26 PMPaul Woitaschek
11/21/2018, 2:30 PMI suspect you are going to say analytics, retrofit, okhttp and many other “true” read-only singletons.
Paul Woitaschek
11/21/2018, 2:30 PMDavid
11/21/2018, 2:31 PMDavid
11/21/2018, 2:31 PMDavid
11/21/2018, 2:31 PMDavid
11/21/2018, 2:34 PMDavid
11/21/2018, 2:34 PMDavid
11/21/2018, 2:34 PMDavid
11/21/2018, 2:34 PMDavid
11/21/2018, 2:37 PMrecipe
a dependency on app
) then you’d need to work as subcomponents do. If on the other hand you “push down” (notice ‘dumb’ modules that contain POJO & POKOS in :model
and analytics
in particular are right at the bottom of the graph) then you can use the @dagger.Component
construct to control what is exposed to consumer modules.Paul Woitaschek
11/21/2018, 2:43 PMDavid
11/21/2018, 2:49 PMDavid
11/21/2018, 2:50 PM