Skip to content

Dagger DI #38

Closed
Closed

Description

@AlexisTercero55

Dagger DI

1. Dagger Dependency Injection: Component Dependency & Scoped Orchestration

We will implement a Pure Dagger architecture using Component Dependencies to maintain strict module encapsulation and explicit lifecycle control.

1.1 Multi-Module Component Topology

To preserve the "Clean Architecture" boundaries, we avoid Subcomponents and instead use Component Dependencies.

  • CoreComponent (in :core:data):
    • Scope: @Singleton.
    • Exposure: Explicitly exposes AuthRepository, SessionManager, and Json infrastructure.
    • Responsibility: Houses stateless or global-state services.
  • UserComponent (in :app or :core:data) [NEW]:
    • Scope: @UserScope.
    • Dependency: CoreComponent.
    • Lifetime: Created upon successful login; invalidated immediately upon logout.
    • Responsibility: Hosts session-sensitive interactors and transient state for flows like Loan Wizards.
  • FeatureComponents (in :features:*):
    • Dependency: CoreComponent (and UserComponent for authenticated features).
    • Responsibility: Provides feature-specific ViewModels via multibinding.

1.2 Scoped Component Management

We will implement a ComponentManager at the :app level to orchestrate the lifecycle of the UserComponent. This ensures that when a user logs out, the entire session-scoped graph is garbage collected, fulfilling fintech requirements for Secure Session Isolation.

1.3 ViewModel Multibinding & Factory

  • Implement a DaggerViewModelFactory in :core:ui that leverages a Map<Class<? extends ViewModel>, Provider<ViewModel>>.
  • Use @IntoMap and @ViewModelKey in feature modules to decouple the UI from the instantiation of business logic.

Phase 1: Environment & Core DI Infrastructure

  1. Dependency Injection & Firebase Setup: Update libs.versions.toml with Dagger 2, Firebase BOM, and DataStore dependencies. Apply plugins and dependencies to all module build.gradle.kts files.
  2. Annotation Definition: Create @UserScope and @ViewModelKey in :core:domain or :core:ui.
  3. Core Data Module: Create CoreModule and CoreComponent in :core:data to provide Json and basic infrastructure.
  4. ViewModel Factory: Implement DaggerViewModelFactory in :core:ui.

Phase 3: Feature & App Layer Integration

  1. Feature Multibinding: Annotate LoginViewModel and HomeViewModel with @Inject and register them in their respective Dagger modules using @IntoMap.
  2. UserComponent Orchestration: Implement the ComponentManager in :app to manage the lifecycle of the @UserScope graph.
  3. Application & Activity Wiring: Initialize the Dagger graph in RhoApplication.kt and trigger injection in MainActivity.kt.

Rho.Studio® - Engineering Department - Contact alexis.tercero@rho.studio

Activity

  1. changed the title [-][Dagger](https://developer.android.com/training/dependency-injection/dagger-android) DI.[/-] [+]Dagger DI[/+] on Aug 11, 2026
  2. moved this from Ready to In progress in UI-Rho-Studio-Componentson Aug 11, 2026
  3. added 3 commits that reference this issue on Aug 14, 2026
  4. 4 remaining items

  5. added 2 commits that reference this issue on Aug 19, 2026
  6. moved this from In progress to In review in UI-Rho-Studio-Componentson Aug 19, 2026
  7. linked a pull request that will close this issue37 data layer and dagger di #42on Aug 19, 2026
  8. moved this from In review to In progress in UI-Rho-Studio-Componentson Aug 19, 2026
  9. moved this from In progress to In review in UI-Rho-Studio-Componentson Aug 19, 2026
  10. linked a pull request that will close this issueDev Iteration - Ready for QA review #43on Aug 19, 2026
  11. moved this from In review to In progress in UI-Rho-Studio-Componentson Aug 19, 2026
  12. moved this from In progress to In review in UI-Rho-Studio-Componentson Aug 19, 2026
  13. linked a pull request that will close this issueRelease v1.0.3 #46on Aug 25, 2026
  14. moved this from In review to In progress in UI-Rho-Studio-Componentson Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

CoreRho Studio UI app codebaseDagger DIDagger2 Dependency injection

Type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions