Приложение
This commit is contained in:
29
client-mobile/profiles/di/ProfileModule.kt
Normal file
29
client-mobile/profiles/di/ProfileModule.kt
Normal file
@@ -0,0 +1,29 @@
|
||||
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): ProfileRepository {
|
||||
return ProfileRepositoryImpl(api, context)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user