Skip to content
This repository was archived by the owner on Dec 10, 2024. It is now read-only.
This repository was archived by the owner on Dec 10, 2024. It is now read-only.

In section, Subcomponents, Tutorial doesn't show, explicitly, removal of registration component injectors from AppComponent #52

@dgoldhirsch

Description

@dgoldhirsch

This paragraph is stated (truthfully): In AppComponent, we have to remove the methods that can inject registration view classes because these won't be used anymore, those classes will use the RegistrationComponent.

But, it'd be helpful to the student to be told explicitly to remove these lines from AppComponent:

    fun inject(activity: RegistrationActivity)
    fun inject(fragment: EnterDetailsFragment)
    fun inject(fragment: TermsAndConditionsFragment)

Furthermore, it'd probably be helpful to add a gotcha warning in the next section of the tutorial ("Scoping Subcomponents"), warning them that if they failed to remove those injector calls from AppComponent they will get this error:

/Users/dg891e/repos/googlecodelabs/android-dagger/app/build/tmp/kapt3/stubs/debug/com/example/android/dagger/di/AppComponent.java:8: error: [Dagger/IncompatiblyScopedBindings] com.example.android.dagger.di.AppComponent scoped with @Singleton may not reference bindings with different scopes:
public abstract interface AppComponent {
                ^
      @com.example.android.dagger.di.ActivityScope class com.example.android.dagger.registration.RegistrationViewModel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions