31 lines
734 B
Kotlin
31 lines
734 B
Kotlin
package contacts.di
|
|
|
|
import contacts.data.remote.api.ContactApi
|
|
import contacts.data.repository.ContactRepositoryImpl
|
|
import contacts.domain.repository.ContactRepository
|
|
import dagger.Module
|
|
import dagger.Provides
|
|
import dagger.hilt.InstallIn
|
|
import dagger.hilt.components.SingletonComponent
|
|
import retrofit2.Retrofit
|
|
import javax.inject.Singleton
|
|
|
|
@Module
|
|
@InstallIn(SingletonComponent::class)
|
|
object ContactModule {
|
|
|
|
@Provides
|
|
@Singleton
|
|
fun provideContactApi(retrofit: Retrofit): ContactApi {
|
|
return retrofit.create(ContactApi::class.java)
|
|
}
|
|
|
|
@Provides
|
|
@Singleton
|
|
fun provideContactRepository(
|
|
api: ContactApi
|
|
): ContactRepository {
|
|
return ContactRepositoryImpl(api)
|
|
}
|
|
}
|