34 lines
864 B
Kotlin
34 lines
864 B
Kotlin
package profiles.di
|
|
|
|
import android.content.Context
|
|
import dagger.Module
|
|
import dagger.Provides
|
|
import dagger.hilt.InstallIn
|
|
import dagger.hilt.components.SingletonComponent
|
|
import profiles.data.remote.api.ProfileApi
|
|
import profiles.data.repository.ProfileRepositoryImpl
|
|
import profiles.domain.repository.ProfileRepository
|
|
import retrofit2.Retrofit
|
|
import javax.inject.Singleton
|
|
|
|
@Module
|
|
@InstallIn(SingletonComponent::class)
|
|
object ProfileModule {
|
|
|
|
@Provides
|
|
@Singleton
|
|
fun provideProfileApi(retrofit: Retrofit): ProfileApi {
|
|
return retrofit.create(ProfileApi::class.java)
|
|
}
|
|
|
|
@Provides
|
|
@Singleton
|
|
fun provideProfileRepository(
|
|
api: ProfileApi,
|
|
context: Context,
|
|
serverConfig: core.network.ServerConfig
|
|
): ProfileRepository {
|
|
return ProfileRepositoryImpl(api, context, serverConfig)
|
|
}
|
|
}
|