Skip to content

dagger 2 injection migrated to hilt#30

Open
ozanturcan wants to merge 1 commit intomuratcanbur:masterfrom
ozanturcan:hilt
Open

dagger 2 injection migrated to hilt#30
ozanturcan wants to merge 1 commit intomuratcanbur:masterfrom
ozanturcan:hilt

Conversation

@ozanturcan
Copy link
Copy Markdown

  • To simplify Dagger-related infrastructure for Android apps.
  • To create a standard set of components and scopes to ease setup, readability/understanding, and code sharing between apps.
  • To provide an easy way to provision different bindings to various build types (e.g. testing, debug, or release).

for more info https://dagger.dev/hilt/

@ozanturcan
Copy link
Copy Markdown
Author

this version not included @viewmodel injection


@Module
@InstallIn(ApplicationComponent::class)
class NetworkModule {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of class, using object is better for here from the performance point of view.


@Module
@InstallIn(ActivityComponent::class)
class PopularTvShowActivityModule {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can delete this Module by

@ActivityScoped
class PopularTVShowsFeedAdapter @Inject constructor() :
    RecyclerView.Adapter<PopularTVShowsFeedAdapter.PopularTVShowsFeedItemViewHolder>() {


@Module
@InstallIn(ApplicationComponent::class)
interface ViewModelModule {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: needless empty space

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I strongly recommend you to open another PR for that change as it effects all of project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants