Dependency Injection in Android With Dagger2 (4)
Component Dependencies
Let’s look at the PresentationComponent more closely.
One strange thing is that PresentationModule has ActivityComponent as its dependency, and it @Provide all the objects provided by ActivityComponent already.
This is rather ugly, can we do something about it?
The answer is Component Dependencies.
The idea is that we can make PresentationComponent depends on ActivityComponent. That way, PresentationComponent automatically gets access to all the objects exposed by ActivityComponent.
After this change, it looks like this:
Twitter
Google+
Facebook
Reddit
LinkedIn
StumbleUpon
Email