Colton Idle
02/10/2023, 4:15 PM:app
module and then a network
module. I want the network module to expose services like BooksService and LibraryService. Those two services require a OkHttpClient. I can also add a provider for the http client, but then okhttpClient provider is exposed to the app.
Anyway to hide that "internal" dependency with dagger?
networkModule's provider declaration:
@Provides
fun provideBooksService(okHttpClient: OkHttpClient): BooksService {
return NetworkBackedBooksService(okHttpClient)
}
@Provides
fun provideLibraryService(okHttpClient: OkHttpClient): LibraryService {
return NetworkBackedLibraryService(okHttpClient)
}
@Provides
fun providesHttpClient(): OkHttpClient {
return //...
}
Mike
02/10/2023, 4:19 PMColton Idle
02/10/2023, 4:34 PMJavier
02/10/2023, 6:38 PMColton Idle
02/10/2023, 9:07 PM