Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Dagger2: Component ependencies
@Module
public class InteractorModule {
    @Provides
    public ILoginInfoInteractor providerILoginInfoInteractor() {
        return InteractorFactory.get(ILoginInfoInteractor.class);
    }
}

@Component(modules = InteractorModule.class)
public interface InteractorComponent {
    ILoginInfoInteractor loginInfoInteractor();
}

@Component(modules = {LoginPresenterModule.class}, dependencies = {InteractorComponent.class})
public interface LoginPresenterComponent extends PresenterComponent{
    void inject(LoginPresenter loginPresenter);
}

LoginPresenter:

@Inject
lateinit var loginInfoInteractor: Lazy<ILoginInfoInteractor>;

DaggerLoginPresenterComponent.builder()
                .loginPresenterModule(LoginPresenterModule())
                .interactorComponent(
                        DaggerInteractorComponent.builder().build()
                )
//                .interactorModule(InteractorModule())
                .build().inject(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.