• Amrita Chaturvedi

    Amrita Chaturvedi

    1 year ago
    Hi, Does anyone here have experience or relevant resources for mocking dagger related dependencies while unit testing in a multi-module clean architecture-based project? Kinda stuck with it here. 😅
    Amrita Chaturvedi
    a
    +2
    20 replies
    Copy to Clipboard
  • Manuel Vivo

    Manuel Vivo

    1 year ago
    Manuel Vivo
    Colton Idle
    2 replies
    Copy to Clipboard
  • escodro

    escodro

    1 year ago
    Hello, everyone! 😊 Is there any gotcha with Hilt + Instrumented Tests? I’m following the Hilt Testing documentation and the Crane sample and can’t make it work at all! If I run with
    --debug
    it only gives me the default:
    Execution failed for task ':app:kaptDebugAndroidTestKotlin'.
    > A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution
    > java.lang.reflect.InvocationTargetException (no error message)
    I’m migrating from Koin to Hilt but this is blocking me once I want to do some end to end tests in my application. Thanks a lot in advance! ❤️
    escodro
    wasyl
    +2
    10 replies
    Copy to Clipboard
  • Lucien Guimaraes

    Lucien Guimaraes

    1 year ago
    Hello 👋 Is there a Dagger way to provide a ViewModel to a Composable Screen ? I'm not using Hilt so I don't have the
    @HiltViewModel
    annotation. How would you achieve it only with Dagger ?
    Lucien Guimaraes
    Colton Idle
    +2
    7 replies
    Copy to Clipboard
  • Jason Ankers

    Jason Ankers

    1 year ago
    Is it permitted to write extension methods/properties on a custom component? I.e im using this to reduce the verbosity of accessing an entrypoint.
    val AuthenticatedComponent.entryPoint: AuthenticatedComponentEntryPoint
        get(): AuthenticatedComponentEntryPoint {
            return EntryPoints.get(this, AuthenticatedComponentEntryPoint::class.java)
        }
    And then I can inject with:
    private val myRepository = authManager.component!!.entryPoint.getMyRepository()
    Edit: Just realized EntryPoints are specific to Hilt and this is a dagger channel
    Jason Ankers
    Jeremy
    4 replies
    Copy to Clipboard
  • m

    miqbaldc

    1 year ago
    Is it possible to use 
    @ApplicationContext
     in DFM (dynamic feature module)? or should we provide application context manually? If we need to provide manually in DFM, is there any reference you guys can point me out?
    DFM - error: [Dagger/MissingBinding] @dagger.hilt.android.qualifiers.ApplicationContext android.content.Context cannot be provided without an @Provides-annotated method.
    opened an issue here: https://github.com/google/dagger/issues/2477
    m
    FunkyMuse
    2 replies
    Copy to Clipboard
  • k

    knthmn

    1 year ago
    I have a class that can be constructor injected, however if I want to install it in a specific component a also scope it, should I put it in a module and
    @Provides
    it?
    k
    FunkyMuse
    3 replies
    Copy to Clipboard
  • André Thiele

    André Thiele

    1 year ago
    Do I need to include dependencies inside the :app module that are provided as @ Singleton from another module? https://stackoverflow.com/questions/66724358/do-i-need-to-include-dependencies-inside-the-app-module-that-are-provided-as-s
    André Thiele
    Javier
    +1
    5 replies
    Copy to Clipboard
  • FunkyMuse

    FunkyMuse

    1 year ago
  • André Thiele

    André Thiele

    1 year ago
    How scope a database to a logged in user using Hilt? The problem is that a database should also be kind of singleton scoped but also scoped to a new user when logging out and in.
    André Thiele
    Colton Idle
    +1
    26 replies
    Copy to Clipboard