dagger 2 injection migrated to hilt#30
Conversation
|
this version not included @viewmodel injection |
|
|
||
| @Module | ||
| @InstallIn(ApplicationComponent::class) | ||
| class NetworkModule { |
There was a problem hiding this comment.
instead of class, using object is better for here from the performance point of view.
|
|
||
| @Module | ||
| @InstallIn(ActivityComponent::class) | ||
| class PopularTvShowActivityModule { |
There was a problem hiding this comment.
You can delete this Module by
@ActivityScoped
class PopularTVShowsFeedAdapter @Inject constructor() :
RecyclerView.Adapter<PopularTVShowsFeedAdapter.PopularTVShowsFeedItemViewHolder>() {
|
|
||
| @Module | ||
| @InstallIn(ApplicationComponent::class) | ||
| interface ViewModelModule { |
There was a problem hiding this comment.
I would be nice if ViewModel is also migrated to Hilt?
https://developer.android.com/training/dependency-injection/hilt-jetpack
| val gradleVersionPlugin = | ||
| "com.github.ben-manes:gradle-versions-plugin:${Versions.gradleVersionPluginVersion}" | ||
| val hilt = "com.google.dagger:hilt-android-gradle-plugin:${Versions.hiltVersion}" | ||
|
|
There was a problem hiding this comment.
Also in:
- buildSrc/src/main/java/co/icanteach/projectx/buildsrc/Plugins.kt
- buildSrc/src/main/java/co/icanteach/projectx/buildsrc/Versions.kt
| } No newline at end of file | ||
|
|
||
| @InstallIn(ApplicationComponent::class) | ||
| class DataModule No newline at end of file |
There was a problem hiding this comment.
DataModule is not needed and can be deleted.
| val kotlinGradleClasspath = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlinVersion}" | ||
| val gradleVersionPlugin = "com.github.ben-manes:gradle-versions-plugin:${Versions.gradleVersionPluginVersion}" | ||
| val kotlinGradleClasspath = | ||
| "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlinVersion}" |
There was a problem hiding this comment.
The formatting of kotlinGradleClasspath and gradleVersionPlugin is different from previous commits. These may be fit 1 line as other dependencies.
| zipStoreBase=GRADLE_USER_HOME | ||
| zipStorePath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip |
There was a problem hiding this comment.
I strongly recommend you to open another PR for that change as it effects all of project.
for more info https://dagger.dev/hilt/