ghedeon
02/01/2019, 12:54 AMapp
gradle module depends on feature
library module). The general advice that I often see: if you don't want to get lost in dagger — don't bring Components to the library modules. It's easier if you just connect all your dagger modules from libraries in the final app
module under one Component.
That works, up to a point. Let say you need to do some manual injection in one of the libraries. But Component is in the app
, so you don't have a direct reference. What are my options here?dkhusainov
02/01/2019, 5:00 AMghedeon
02/01/2019, 7:37 PMJoe
02/01/2019, 7:44 PMghedeon
02/01/2019, 7:55 PMis it possible for the feature component to include some modulesnot in this setup. It's just an interface in the feature, not a real component, so you can't attach modules to it. Ex: 1.
FeatureComponent
interface and FeatureModule
is defined in feauture
library. Plus, some kind of a singleton, where you set you component later.
2. In the app, AppComponent
is a real dagger component, that extends FeatureComponent
interface and uses FeatureModule
3. Once you have AppComponent
instance, set it to your singleton, that you defined in the feature. Now it can be used in the feature library.Joe
02/01/2019, 7:58 PMghedeon
02/01/2019, 7:59 PMDavid
02/01/2019, 8:29 PMJoe
02/01/2019, 8:37 PMDavid
02/01/2019, 8:43 PM@BindsInstance
type annotationsThis ideal prohibits app-> module tangle like that.I lied. I always have a module API that needs a
Context
. But genuinely, that’s itJoe
02/01/2019, 8:57 PMghedeon
02/01/2019, 8:58 PMapp
/ \
feature1 feature2
\ /
core
meaning that core dependencies are shared by the feature modules.David
02/01/2019, 9:07 PM:core
becoming a dumping ground. So long as it is lean (XML, Styles, annotations etc.) I think you’re good. Unless the diamond shape is some antipattern I’m unaware of!:model
module is a bit of an antipattern as is :domain
. The models and DAOs to which they map are migrating to feature modules as I complete my IA and move onto Dynamic Feature Modulesghedeon
02/01/2019, 9:12 PM:core
is not that light as you described it. Many times features are using similar entities and rest services, so core layer can get pretty advanced, most probably even splitted into core-data/core-domain/core-ui
.David
02/01/2019, 9:14 PM:api-client
) and have this “blob” module called :model
:api-client-water
:api-client-tide
:api-client-weather
:model-water
:model-tide
:model-weather
@Reusable
for their DataAdapters and being done with it.ghedeon
02/01/2019, 9:29 PM