Use @Singleton where possible
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
package gq.kirmanak.mealient.di
|
||||
|
||||
import android.accounts.AccountManager
|
||||
import android.content.Context
|
||||
import dagger.Binds
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import gq.kirmanak.mealient.data.auth.AuthDataSource
|
||||
import gq.kirmanak.mealient.data.auth.AuthRepo
|
||||
@@ -31,11 +34,14 @@ interface AuthModule {
|
||||
}
|
||||
|
||||
@Binds
|
||||
@Singleton
|
||||
fun bindAuthDataSource(authDataSourceImpl: AuthDataSourceImpl): AuthDataSource
|
||||
|
||||
@Binds
|
||||
@Singleton
|
||||
fun bindAuthStorage(authStorageImpl: AuthStorageImpl): AuthStorage
|
||||
|
||||
@Binds
|
||||
@Singleton
|
||||
fun bindAuthRepo(authRepo: AuthRepoImpl): AuthRepo
|
||||
}
|
||||
|
||||
@@ -6,10 +6,13 @@ import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import gq.kirmanak.mealient.data.disclaimer.DisclaimerStorage
|
||||
import gq.kirmanak.mealient.data.disclaimer.DisclaimerStorageImpl
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
interface DisclaimerModule {
|
||||
|
||||
@Binds
|
||||
@Singleton
|
||||
fun provideDisclaimerStorage(disclaimerStorageImpl: DisclaimerStorageImpl): DisclaimerStorage
|
||||
}
|
||||
@@ -23,16 +23,21 @@ import javax.inject.Singleton
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
interface RecipeModule {
|
||||
|
||||
@Binds
|
||||
@Singleton
|
||||
fun provideRecipeDataSource(recipeDataSourceImpl: RecipeDataSourceImpl): RecipeDataSource
|
||||
|
||||
@Binds
|
||||
@Singleton
|
||||
fun provideRecipeStorage(recipeStorageImpl: RecipeStorageImpl): RecipeStorage
|
||||
|
||||
@Binds
|
||||
@Singleton
|
||||
fun provideRecipeRepo(recipeRepoImpl: RecipeRepoImpl): RecipeRepo
|
||||
|
||||
@Binds
|
||||
@Singleton
|
||||
fun provideRecipeImageLoader(recipeImageLoaderImpl: RecipeImageLoaderImpl): RecipeImageLoader
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -14,7 +14,9 @@ import javax.inject.Singleton
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
interface UiModule {
|
||||
|
||||
@Binds
|
||||
@Singleton
|
||||
fun bindImageLoader(imageLoaderGlide: ImageLoaderPicasso): ImageLoader
|
||||
|
||||
companion object {
|
||||
|
||||
Reference in New Issue
Block a user