Skip to content

Instantly share code, notes, and snippets.

@krzdabrowski
Last active April 16, 2023 17:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save krzdabrowski/a0af21e0249d2e1ea4cced2848bd361a to your computer and use it in GitHub Desktop.
@Module
@InstallIn(SingletonComponent::class)
internal object RocketModule {
@Provides
@Singleton
fun provideRocketApi(
retrofit: Retrofit
): RocketApi {
return retrofit.create(RocketApi::class.java)
}
@Provides
fun provideGetRocketsUseCase(
rocketRepository: RocketRepository
): GetRocketsUseCase {
return GetRocketsUseCase {
getRockets(rocketRepository)
}
}
@Provides
fun provideRefreshRocketsUseCase(
rocketRepository: RocketRepository
): RefreshRocketsUseCase {
return RefreshRocketsUseCase {
refreshRockets(rocketRepository)
}
}
@Module
@InstallIn(SingletonComponent::class)
interface BindsModule {
@Binds
@Singleton
fun bindRocketRepository(impl: RocketRepositoryImpl): RocketRepository
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment