Use Hilt for Dagger configuration
- Dominant language
- Kotlin
- Stars
- 5.6k
- Forks
- 2k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 92
Description
Reference: https://developer.android.com/training/dependency-injection/hilt-android
Migration guide: https://dagger.dev/hilt/migration-guide.html
This will ease most of the Dagger handling, in a standard way and without having to manage custom classes (most of our `di` package will become unnecessary as it's handled by Hilt).
Outline of expected changes:
- `ActivityInjector/FragmentInjector` + `Injectable` get replaced by `@AndroidEntryPoint` annotation on fragments/activities. This also autogenerates `ComponentsModule` for us.
- `MainApp` is annotated with `@HiltAndroidApp` and DI initialization code is not needed anymore
- `Component`s are autogenerated, just need to use `@InstallIn(SingletonComponent)` or equivalent in module declarations. List of available components here: https://dagger.dev/hilt/components.html
- Custom `ViewModelFactory`, `ViewModelModule` and related classes not needed anymore, annotate VMs with `@HiltViewModel` and use normal `ViewmodelProvider` in fragments/activities
Contributor guide
Assessment
This issue has not been assessed yet.