[chore]: Migrate Architecture to Dependency Injection (Hilt)
- Dominant language
- Kotlin
- Stars
- 0
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
### Problem Description
The app relies on manual dependency injection. As the app scales, this manual wiring creates boilerplate and makes testing difficult.
### Expected Solution
Refactor the codebase to use Dagger-Hilt for automated dependency injection.
### Steps to Reproduce
1. Check `StocksActivity.kt` and `StockViewModelProviderFactory.kt` to see manual repository passing.
### Proposed Fix
Add Hilt Gradle plugins. Annotate the application with `@HiltAndroidApp`. Create a `di/AppModule.kt` to provide singletons of Room and Retrofit. Update ViewModels with `@HiltViewModel` and inject them into Fragments using `by viewModels()`.
### Concerned Files
* `build.gradle.kts`
* `StocksApplication.kt`
* `AppModule.kt` (new)
* All ViewModels and Fragments
---
### Acceptance Criteria
- [ ] `StockViewModelProviderFactory` is completely deleted from the project.
- [ ] ViewModels are injected natively.
- [ ] The app compiles and runs perfectly using Hilt injection.
Contributor guide
Research direction
Start with build.gradle.kts, StocksApplication.kt, StocksActivity.kt, and StockViewModelProviderFactory.kt to map the current manual wiring. Then review the ViewModels, Fragments, and the proposed AppModule.kt; done means the factory is deleted, ViewModels are natively injected, and the app compiles and runs with Hilt.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100