Repository navigation
Closed
Labels
CoreRho Studio UI app codebaseRho Studio UI app codebaseDagger DIDagger2 Dependency injectionDagger2 Dependency injection
Milestone
Description
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, andJsoninfrastructure. - Responsibility: Houses stateless or global-state services.
- Scope:
UserComponent(in:appor: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.
- Scope:
FeatureComponents (in:features:*):- Dependency:
CoreComponent(andUserComponentfor authenticated features). - Responsibility: Provides feature-specific ViewModels via multibinding.
- Dependency:
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
DaggerViewModelFactoryin:core:uithat leverages aMap<Class<? extends ViewModel>, Provider<ViewModel>>. - Use
@IntoMapand@ViewModelKeyin feature modules to decouple the UI from the instantiation of business logic.
Phase 1: Environment & Core DI Infrastructure
- Dependency Injection & Firebase Setup: Update
libs.versions.tomlwith Dagger 2, Firebase BOM, and DataStore dependencies. Apply plugins and dependencies to all modulebuild.gradle.ktsfiles. - Annotation Definition: Create
@UserScopeand@ViewModelKeyin:core:domainor:core:ui. - Core Data Module: Create
CoreModuleandCoreComponentin:core:datato provideJsonand basic infrastructure. - ViewModel Factory: Implement
DaggerViewModelFactoryin:core:ui.
Phase 3: Feature & App Layer Integration
- Feature Multibinding: Annotate
LoginViewModelandHomeViewModelwith@Injectand register them in their respective Dagger modules using@IntoMap. - UserComponent Orchestration: Implement the
ComponentManagerin:appto manage the lifecycle of the@UserScopegraph. - Application & Activity Wiring: Initialize the Dagger graph in
RhoApplication.ktand trigger injection inMainActivity.kt.
Rho.Studio® - Engineering Department - Contact alexis.tercero@rho.studio
Metadata
Metadata
Assignees
Labels
CoreRho Studio UI app codebaseRho Studio UI app codebaseDagger DIDagger2 Dependency injectionDagger2 Dependency injection
Type
Projects
- StatusShow more project fieldsDone
Activity
[-][Dagger](https://developer.android.com/training/dependency-injection/dagger-android) DI.[/-][+]Dagger DI[/+]NEW | #38 Dagger implementation
NEW | #38 Home Module
CHANGE | #38 AppScope: MainActivity.kt and DI
4 remaining items
CHANGE | #38 HeaderViewModel DI SetUp
CHANGE | #38 HomeViewModel DI SetUp