Reduce memory footprint of Hilt (#159)
* Remove @Singleton where it is not needed * Use @AssistedFactory where possible
This commit is contained in:
@@ -10,9 +10,7 @@ import kotlinx.coroutines.flow.Flow
|
|||||||
import kotlinx.coroutines.flow.first
|
import kotlinx.coroutines.flow.first
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class AddRecipeRepoImpl @Inject constructor(
|
class AddRecipeRepoImpl @Inject constructor(
|
||||||
private val addRecipeDataSource: AddRecipeDataSource,
|
private val addRecipeDataSource: AddRecipeDataSource,
|
||||||
private val addRecipeStorage: AddRecipeStorage,
|
private val addRecipeStorage: AddRecipeStorage,
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ import gq.kirmanak.mealient.datasource.v0.models.CreateApiTokenRequestV0
|
|||||||
import gq.kirmanak.mealient.datasource.v1.MealieDataSourceV1
|
import gq.kirmanak.mealient.datasource.v1.MealieDataSourceV1
|
||||||
import gq.kirmanak.mealient.datasource.v1.models.CreateApiTokenRequestV1
|
import gq.kirmanak.mealient.datasource.v1.models.CreateApiTokenRequestV1
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class AuthDataSourceImpl @Inject constructor(
|
class AuthDataSourceImpl @Inject constructor(
|
||||||
private val serverInfoRepo: ServerInfoRepo,
|
private val serverInfoRepo: ServerInfoRepo,
|
||||||
private val v0Source: MealieDataSourceV0,
|
private val v0Source: MealieDataSourceV0,
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ import gq.kirmanak.mealient.logging.Logger
|
|||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class AuthRepoImpl @Inject constructor(
|
class AuthRepoImpl @Inject constructor(
|
||||||
private val authStorage: AuthStorage,
|
private val authStorage: AuthStorage,
|
||||||
private val authDataSource: AuthDataSource,
|
private val authDataSource: AuthDataSource,
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ import kotlinx.coroutines.flow.Flow
|
|||||||
import kotlinx.coroutines.flow.filterNotNull
|
import kotlinx.coroutines.flow.filterNotNull
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class ServerInfoRepoImpl @Inject constructor(
|
class ServerInfoRepoImpl @Inject constructor(
|
||||||
private val serverInfoStorage: ServerInfoStorage,
|
private val serverInfoStorage: ServerInfoStorage,
|
||||||
private val versionDataSource: VersionDataSource,
|
private val versionDataSource: VersionDataSource,
|
||||||
|
|||||||
@@ -9,9 +9,7 @@ import kotlinx.coroutines.async
|
|||||||
import kotlinx.coroutines.awaitAll
|
import kotlinx.coroutines.awaitAll
|
||||||
import kotlinx.coroutines.coroutineScope
|
import kotlinx.coroutines.coroutineScope
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class VersionDataSourceImpl @Inject constructor(
|
class VersionDataSourceImpl @Inject constructor(
|
||||||
private val v0Source: MealieDataSourceV0,
|
private val v0Source: MealieDataSourceV0,
|
||||||
private val v1Source: MealieDataSourceV1,
|
private val v1Source: MealieDataSourceV1,
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ import gq.kirmanak.mealient.data.baseurl.ServerInfoStorage
|
|||||||
import gq.kirmanak.mealient.data.storage.PreferencesStorage
|
import gq.kirmanak.mealient.data.storage.PreferencesStorage
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class ServerInfoStorageImpl @Inject constructor(
|
class ServerInfoStorageImpl @Inject constructor(
|
||||||
private val preferencesStorage: PreferencesStorage,
|
private val preferencesStorage: PreferencesStorage,
|
||||||
) : ServerInfoStorage {
|
) : ServerInfoStorage {
|
||||||
|
|||||||
@@ -3,17 +3,10 @@ package gq.kirmanak.mealient.data.configuration
|
|||||||
import gq.kirmanak.mealient.BuildConfig
|
import gq.kirmanak.mealient.BuildConfig
|
||||||
import gq.kirmanak.mealient.architecture.configuration.BuildConfiguration
|
import gq.kirmanak.mealient.architecture.configuration.BuildConfiguration
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class BuildConfigurationImpl @Inject constructor() : BuildConfiguration {
|
class BuildConfigurationImpl @Inject constructor() : BuildConfiguration {
|
||||||
|
|
||||||
@get:JvmName("_isDebug")
|
override fun isDebug(): Boolean = BuildConfig.DEBUG
|
||||||
private val isDebug by lazy { BuildConfig.DEBUG }
|
|
||||||
|
|
||||||
private val versionCode by lazy { BuildConfig.VERSION_CODE }
|
override fun versionCode(): Int = BuildConfig.VERSION_CODE
|
||||||
|
|
||||||
override fun isDebug(): Boolean = isDebug
|
|
||||||
|
|
||||||
override fun versionCode(): Int = versionCode
|
|
||||||
}
|
}
|
||||||
@@ -6,9 +6,7 @@ import gq.kirmanak.mealient.logging.Logger
|
|||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class DisclaimerStorageImpl @Inject constructor(
|
class DisclaimerStorageImpl @Inject constructor(
|
||||||
private val preferencesStorage: PreferencesStorage,
|
private val preferencesStorage: PreferencesStorage,
|
||||||
private val logger: Logger,
|
private val logger: Logger,
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ import gq.kirmanak.mealient.datastore.DataStoreModule.Companion.ENCRYPTED
|
|||||||
import gq.kirmanak.mealient.logging.Logger
|
import gq.kirmanak.mealient.logging.Logger
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Named
|
import javax.inject.Named
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class From24AuthMigrationExecutor @Inject constructor(
|
class From24AuthMigrationExecutor @Inject constructor(
|
||||||
@Named(ENCRYPTED) private val sharedPreferences: SharedPreferences,
|
@Named(ENCRYPTED) private val sharedPreferences: SharedPreferences,
|
||||||
private val authRepo: AuthRepo,
|
private val authRepo: AuthRepo,
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ import gq.kirmanak.mealient.data.storage.PreferencesStorage
|
|||||||
import gq.kirmanak.mealient.datasource.runCatchingExceptCancel
|
import gq.kirmanak.mealient.datasource.runCatchingExceptCancel
|
||||||
import gq.kirmanak.mealient.logging.Logger
|
import gq.kirmanak.mealient.logging.Logger
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class MigrationDetectorImpl @Inject constructor(
|
class MigrationDetectorImpl @Inject constructor(
|
||||||
private val preferencesStorage: PreferencesStorage,
|
private val preferencesStorage: PreferencesStorage,
|
||||||
private val migrationExecutors: Set<@JvmSuppressWildcards MigrationExecutor>,
|
private val migrationExecutors: Set<@JvmSuppressWildcards MigrationExecutor>,
|
||||||
@@ -15,7 +13,6 @@ class MigrationDetectorImpl @Inject constructor(
|
|||||||
private val logger: Logger,
|
private val logger: Logger,
|
||||||
) : MigrationDetector {
|
) : MigrationDetector {
|
||||||
|
|
||||||
|
|
||||||
override suspend fun executeMigrations() {
|
override suspend fun executeMigrations() {
|
||||||
val key = preferencesStorage.lastExecutedMigrationVersionKey
|
val key = preferencesStorage.lastExecutedMigrationVersionKey
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,7 @@ import gq.kirmanak.mealient.datasource.v0.MealieDataSourceV0
|
|||||||
import gq.kirmanak.mealient.datasource.v1.MealieDataSourceV1
|
import gq.kirmanak.mealient.datasource.v1.MealieDataSourceV1
|
||||||
import gq.kirmanak.mealient.model_mapper.ModelMapper
|
import gq.kirmanak.mealient.model_mapper.ModelMapper
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class MealieDataSourceWrapper @Inject constructor(
|
class MealieDataSourceWrapper @Inject constructor(
|
||||||
private val serverInfoRepo: ServerInfoRepo,
|
private val serverInfoRepo: ServerInfoRepo,
|
||||||
private val v0Source: MealieDataSourceV0,
|
private val v0Source: MealieDataSourceV0,
|
||||||
|
|||||||
@@ -4,9 +4,7 @@ import gq.kirmanak.mealient.data.baseurl.ServerInfoRepo
|
|||||||
import gq.kirmanak.mealient.logging.Logger
|
import gq.kirmanak.mealient.logging.Logger
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class RecipeImageUrlProviderImpl @Inject constructor(
|
class RecipeImageUrlProviderImpl @Inject constructor(
|
||||||
private val serverInfoRepo: ServerInfoRepo,
|
private val serverInfoRepo: ServerInfoRepo,
|
||||||
private val logger: Logger,
|
private val logger: Logger,
|
||||||
|
|||||||
@@ -12,10 +12,8 @@ import gq.kirmanak.mealient.datasource.runCatchingExceptCancel
|
|||||||
import gq.kirmanak.mealient.logging.Logger
|
import gq.kirmanak.mealient.logging.Logger
|
||||||
import gq.kirmanak.mealient.model_mapper.ModelMapper
|
import gq.kirmanak.mealient.model_mapper.ModelMapper
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@OptIn(ExperimentalPagingApi::class)
|
@OptIn(ExperimentalPagingApi::class)
|
||||||
@Singleton
|
|
||||||
class RecipeRepoImpl @Inject constructor(
|
class RecipeRepoImpl @Inject constructor(
|
||||||
private val mediator: RecipesRemoteMediator,
|
private val mediator: RecipesRemoteMediator,
|
||||||
private val storage: RecipeStorage,
|
private val storage: RecipeStorage,
|
||||||
|
|||||||
@@ -4,9 +4,7 @@ import androidx.core.util.PatternsCompat
|
|||||||
import gq.kirmanak.mealient.datasource.models.ParseRecipeURLInfo
|
import gq.kirmanak.mealient.datasource.models.ParseRecipeURLInfo
|
||||||
import gq.kirmanak.mealient.logging.Logger
|
import gq.kirmanak.mealient.logging.Logger
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class ShareRecipeRepoImpl @Inject constructor(
|
class ShareRecipeRepoImpl @Inject constructor(
|
||||||
private val logger: Logger,
|
private val logger: Logger,
|
||||||
private val parseRecipeDataSource: ParseRecipeDataSource,
|
private val parseRecipeDataSource: ParseRecipeDataSource,
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import gq.kirmanak.mealient.data.add.impl.AddRecipeRepoImpl
|
|||||||
import gq.kirmanak.mealient.data.network.MealieDataSourceWrapper
|
import gq.kirmanak.mealient.data.network.MealieDataSourceWrapper
|
||||||
import gq.kirmanak.mealient.datastore.recipe.AddRecipeStorage
|
import gq.kirmanak.mealient.datastore.recipe.AddRecipeStorage
|
||||||
import gq.kirmanak.mealient.datastore.recipe.AddRecipeStorageImpl
|
import gq.kirmanak.mealient.datastore.recipe.AddRecipeStorageImpl
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@InstallIn(SingletonComponent::class)
|
@InstallIn(SingletonComponent::class)
|
||||||
@@ -18,14 +17,11 @@ interface AddRecipeModule {
|
|||||||
|
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun provideAddRecipeRepo(repo: AddRecipeRepoImpl): AddRecipeRepo
|
fun provideAddRecipeRepo(repo: AddRecipeRepoImpl): AddRecipeRepo
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindAddRecipeDataSource(mealieDataSourceWrapper: MealieDataSourceWrapper): AddRecipeDataSource
|
fun bindAddRecipeDataSource(mealieDataSourceWrapper: MealieDataSourceWrapper): AddRecipeDataSource
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindAddRecipeStorage(addRecipeStorageImpl: AddRecipeStorageImpl): AddRecipeStorage
|
fun bindAddRecipeStorage(addRecipeStorageImpl: AddRecipeStorageImpl): AddRecipeStorage
|
||||||
}
|
}
|
||||||
@@ -27,6 +27,5 @@ interface AppModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindPreferencesStorage(preferencesStorage: PreferencesStorageImpl): PreferencesStorage
|
fun bindPreferencesStorage(preferencesStorage: PreferencesStorageImpl): PreferencesStorage
|
||||||
}
|
}
|
||||||
@@ -6,13 +6,11 @@ import dagger.hilt.InstallIn
|
|||||||
import dagger.hilt.components.SingletonComponent
|
import dagger.hilt.components.SingletonComponent
|
||||||
import gq.kirmanak.mealient.architecture.configuration.BuildConfiguration
|
import gq.kirmanak.mealient.architecture.configuration.BuildConfiguration
|
||||||
import gq.kirmanak.mealient.data.configuration.BuildConfigurationImpl
|
import gq.kirmanak.mealient.data.configuration.BuildConfigurationImpl
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@InstallIn(SingletonComponent::class)
|
@InstallIn(SingletonComponent::class)
|
||||||
interface ArchitectureModule {
|
interface ArchitectureModule {
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindBuildConfiguration(buildConfigurationImpl: BuildConfigurationImpl): BuildConfiguration
|
fun bindBuildConfiguration(buildConfigurationImpl: BuildConfigurationImpl): BuildConfiguration
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,8 @@
|
|||||||
package gq.kirmanak.mealient.di
|
package gq.kirmanak.mealient.di
|
||||||
|
|
||||||
import android.accounts.AccountManager
|
|
||||||
import android.content.Context
|
|
||||||
import dagger.Binds
|
import dagger.Binds
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
|
||||||
import dagger.hilt.InstallIn
|
import dagger.hilt.InstallIn
|
||||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
|
||||||
import dagger.hilt.components.SingletonComponent
|
import dagger.hilt.components.SingletonComponent
|
||||||
import gq.kirmanak.mealient.data.auth.AuthDataSource
|
import gq.kirmanak.mealient.data.auth.AuthDataSource
|
||||||
import gq.kirmanak.mealient.data.auth.AuthRepo
|
import gq.kirmanak.mealient.data.auth.AuthRepo
|
||||||
@@ -16,38 +12,23 @@ import gq.kirmanak.mealient.data.auth.impl.AuthRepoImpl
|
|||||||
import gq.kirmanak.mealient.data.auth.impl.AuthStorageImpl
|
import gq.kirmanak.mealient.data.auth.impl.AuthStorageImpl
|
||||||
import gq.kirmanak.mealient.datasource.AuthenticationProvider
|
import gq.kirmanak.mealient.datasource.AuthenticationProvider
|
||||||
import gq.kirmanak.mealient.shopping_lists.repo.ShoppingListsAuthRepo
|
import gq.kirmanak.mealient.shopping_lists.repo.ShoppingListsAuthRepo
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@InstallIn(SingletonComponent::class)
|
@InstallIn(SingletonComponent::class)
|
||||||
interface AuthModule {
|
interface AuthModule {
|
||||||
|
|
||||||
companion object {
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
@Singleton
|
|
||||||
fun provideAccountManager(@ApplicationContext context: Context): AccountManager {
|
|
||||||
return AccountManager.get(context)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindAuthDataSource(authDataSourceImpl: AuthDataSourceImpl): AuthDataSource
|
fun bindAuthDataSource(authDataSourceImpl: AuthDataSourceImpl): AuthDataSource
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindAuthRepo(authRepo: AuthRepoImpl): AuthRepo
|
fun bindAuthRepo(authRepo: AuthRepoImpl): AuthRepo
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindAuthProvider(authRepo: AuthRepoImpl): AuthenticationProvider
|
fun bindAuthProvider(authRepo: AuthRepoImpl): AuthenticationProvider
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindAuthStorage(authStorageImpl: AuthStorageImpl): AuthStorage
|
fun bindAuthStorage(authStorageImpl: AuthStorageImpl): AuthStorage
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindShoppingListsAuthRepo(impl: AuthRepoImpl): ShoppingListsAuthRepo
|
fun bindShoppingListsAuthRepo(impl: AuthRepoImpl): ShoppingListsAuthRepo
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,25 +7,20 @@ import dagger.hilt.components.SingletonComponent
|
|||||||
import gq.kirmanak.mealient.data.baseurl.*
|
import gq.kirmanak.mealient.data.baseurl.*
|
||||||
import gq.kirmanak.mealient.data.baseurl.impl.ServerInfoStorageImpl
|
import gq.kirmanak.mealient.data.baseurl.impl.ServerInfoStorageImpl
|
||||||
import gq.kirmanak.mealient.datasource.ServerUrlProvider
|
import gq.kirmanak.mealient.datasource.ServerUrlProvider
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@InstallIn(SingletonComponent::class)
|
@InstallIn(SingletonComponent::class)
|
||||||
interface BaseURLModule {
|
interface BaseURLModule {
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindVersionDataSource(versionDataSourceImpl: VersionDataSourceImpl): VersionDataSource
|
fun bindVersionDataSource(versionDataSourceImpl: VersionDataSourceImpl): VersionDataSource
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindBaseUrlStorage(baseURLStorageImpl: ServerInfoStorageImpl): ServerInfoStorage
|
fun bindBaseUrlStorage(baseURLStorageImpl: ServerInfoStorageImpl): ServerInfoStorage
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindServerInfoRepo(serverInfoRepoImpl: ServerInfoRepoImpl): ServerInfoRepo
|
fun bindServerInfoRepo(serverInfoRepoImpl: ServerInfoRepoImpl): ServerInfoRepo
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindServerUrlProvider(serverInfoRepoImpl: ServerInfoRepoImpl): ServerUrlProvider
|
fun bindServerUrlProvider(serverInfoRepoImpl: ServerInfoRepoImpl): ServerUrlProvider
|
||||||
}
|
}
|
||||||
@@ -6,13 +6,11 @@ import dagger.hilt.InstallIn
|
|||||||
import dagger.hilt.components.SingletonComponent
|
import dagger.hilt.components.SingletonComponent
|
||||||
import gq.kirmanak.mealient.data.disclaimer.DisclaimerStorage
|
import gq.kirmanak.mealient.data.disclaimer.DisclaimerStorage
|
||||||
import gq.kirmanak.mealient.data.disclaimer.DisclaimerStorageImpl
|
import gq.kirmanak.mealient.data.disclaimer.DisclaimerStorageImpl
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@InstallIn(SingletonComponent::class)
|
@InstallIn(SingletonComponent::class)
|
||||||
interface DisclaimerModule {
|
interface DisclaimerModule {
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun provideDisclaimerStorage(disclaimerStorageImpl: DisclaimerStorageImpl): DisclaimerStorage
|
fun provideDisclaimerStorage(disclaimerStorageImpl: DisclaimerStorageImpl): DisclaimerStorage
|
||||||
}
|
}
|
||||||
@@ -9,18 +9,15 @@ import gq.kirmanak.mealient.data.migration.From24AuthMigrationExecutor
|
|||||||
import gq.kirmanak.mealient.data.migration.MigrationDetector
|
import gq.kirmanak.mealient.data.migration.MigrationDetector
|
||||||
import gq.kirmanak.mealient.data.migration.MigrationDetectorImpl
|
import gq.kirmanak.mealient.data.migration.MigrationDetectorImpl
|
||||||
import gq.kirmanak.mealient.data.migration.MigrationExecutor
|
import gq.kirmanak.mealient.data.migration.MigrationExecutor
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@InstallIn(SingletonComponent::class)
|
@InstallIn(SingletonComponent::class)
|
||||||
interface MigrationModule {
|
interface MigrationModule {
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
@IntoSet
|
@IntoSet
|
||||||
fun bindFrom24AuthMigrationExecutor(from24AuthMigrationExecutor: From24AuthMigrationExecutor): MigrationExecutor
|
fun bindFrom24AuthMigrationExecutor(from24AuthMigrationExecutor: From24AuthMigrationExecutor): MigrationExecutor
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindMigrationDetector(migrationDetectorImpl: MigrationDetectorImpl): MigrationDetector
|
fun bindMigrationDetector(migrationDetectorImpl: MigrationDetectorImpl): MigrationDetector
|
||||||
}
|
}
|
||||||
@@ -15,36 +15,29 @@ import gq.kirmanak.mealient.data.recipes.network.RecipeDataSource
|
|||||||
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
import gq.kirmanak.mealient.ui.recipes.images.RecipeModelLoaderFactory
|
import gq.kirmanak.mealient.ui.recipes.images.RecipeModelLoaderFactory
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@InstallIn(SingletonComponent::class)
|
@InstallIn(SingletonComponent::class)
|
||||||
interface RecipeModule {
|
interface RecipeModule {
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun provideRecipeDataSource(mealieDataSourceWrapper: MealieDataSourceWrapper): RecipeDataSource
|
fun provideRecipeDataSource(mealieDataSourceWrapper: MealieDataSourceWrapper): RecipeDataSource
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun provideRecipeRepo(recipeRepoImpl: RecipeRepoImpl): RecipeRepo
|
fun provideRecipeRepo(recipeRepoImpl: RecipeRepoImpl): RecipeRepo
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindImageUrlProvider(recipeImageUrlProviderImpl: RecipeImageUrlProviderImpl): RecipeImageUrlProvider
|
fun bindImageUrlProvider(recipeImageUrlProviderImpl: RecipeImageUrlProviderImpl): RecipeImageUrlProvider
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindModelLoaderFactory(recipeModelLoaderFactory: RecipeModelLoaderFactory): ModelLoaderFactory<RecipeSummaryEntity, InputStream>
|
fun bindModelLoaderFactory(recipeModelLoaderFactory: RecipeModelLoaderFactory): ModelLoaderFactory<RecipeSummaryEntity, InputStream>
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindRecipePagingSourceFactory(recipePagingSourceFactoryImpl: RecipePagingSourceFactoryImpl): RecipePagingSourceFactory
|
fun bindRecipePagingSourceFactory(recipePagingSourceFactoryImpl: RecipePagingSourceFactoryImpl): RecipePagingSourceFactory
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
|
||||||
fun provideGlideRequestOptions(): RequestOptions = RequestOptions.centerCropTransform()
|
fun provideGlideRequestOptions(): RequestOptions = RequestOptions.centerCropTransform()
|
||||||
.placeholder(R.drawable.placeholder_recipe)
|
.placeholder(R.drawable.placeholder_recipe)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,17 +8,14 @@ import gq.kirmanak.mealient.data.network.MealieDataSourceWrapper
|
|||||||
import gq.kirmanak.mealient.data.share.ParseRecipeDataSource
|
import gq.kirmanak.mealient.data.share.ParseRecipeDataSource
|
||||||
import gq.kirmanak.mealient.data.share.ShareRecipeRepo
|
import gq.kirmanak.mealient.data.share.ShareRecipeRepo
|
||||||
import gq.kirmanak.mealient.data.share.ShareRecipeRepoImpl
|
import gq.kirmanak.mealient.data.share.ShareRecipeRepoImpl
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@InstallIn(SingletonComponent::class)
|
@InstallIn(SingletonComponent::class)
|
||||||
interface ShareRecipeModule {
|
interface ShareRecipeModule {
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindShareRecipeRepo(shareRecipeRepoImpl: ShareRecipeRepoImpl): ShareRecipeRepo
|
fun bindShareRecipeRepo(shareRecipeRepoImpl: ShareRecipeRepoImpl): ShareRecipeRepo
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindParseRecipeDataSource(mealieDataSourceWrapper: MealieDataSourceWrapper): ParseRecipeDataSource
|
fun bindParseRecipeDataSource(mealieDataSourceWrapper: MealieDataSourceWrapper): ParseRecipeDataSource
|
||||||
}
|
}
|
||||||
@@ -5,31 +5,29 @@ import com.bumptech.glide.load.model.GlideUrl
|
|||||||
import com.bumptech.glide.load.model.ModelCache
|
import com.bumptech.glide.load.model.ModelCache
|
||||||
import com.bumptech.glide.load.model.ModelLoader
|
import com.bumptech.glide.load.model.ModelLoader
|
||||||
import com.bumptech.glide.load.model.stream.BaseGlideUrlLoader
|
import com.bumptech.glide.load.model.stream.BaseGlideUrlLoader
|
||||||
|
import dagger.assisted.Assisted
|
||||||
|
import dagger.assisted.AssistedFactory
|
||||||
|
import dagger.assisted.AssistedInject
|
||||||
import gq.kirmanak.mealient.data.recipes.impl.RecipeImageUrlProvider
|
import gq.kirmanak.mealient.data.recipes.impl.RecipeImageUrlProvider
|
||||||
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
import gq.kirmanak.mealient.logging.Logger
|
import gq.kirmanak.mealient.logging.Logger
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import javax.inject.Inject
|
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
class RecipeModelLoader private constructor(
|
class RecipeModelLoader @AssistedInject constructor(
|
||||||
private val recipeImageUrlProvider: RecipeImageUrlProvider,
|
private val recipeImageUrlProvider: RecipeImageUrlProvider,
|
||||||
private val logger: Logger,
|
private val logger: Logger,
|
||||||
concreteLoader: ModelLoader<GlideUrl, InputStream>,
|
@Assisted concreteLoader: ModelLoader<GlideUrl, InputStream>,
|
||||||
cache: ModelCache<RecipeSummaryEntity, GlideUrl>,
|
@Assisted cache: ModelCache<RecipeSummaryEntity, GlideUrl>,
|
||||||
) : BaseGlideUrlLoader<RecipeSummaryEntity>(concreteLoader, cache) {
|
) : BaseGlideUrlLoader<RecipeSummaryEntity>(concreteLoader, cache) {
|
||||||
|
|
||||||
@Singleton
|
@AssistedFactory
|
||||||
class Factory @Inject constructor(
|
interface Factory {
|
||||||
private val recipeImageUrlProvider: RecipeImageUrlProvider,
|
|
||||||
private val logger: Logger,
|
|
||||||
) {
|
|
||||||
|
|
||||||
fun build(
|
fun build(
|
||||||
concreteLoader: ModelLoader<GlideUrl, InputStream>,
|
concreteLoader: ModelLoader<GlideUrl, InputStream>,
|
||||||
cache: ModelCache<RecipeSummaryEntity, GlideUrl>,
|
cache: ModelCache<RecipeSummaryEntity, GlideUrl>,
|
||||||
) = RecipeModelLoader(recipeImageUrlProvider, logger, concreteLoader, cache)
|
): RecipeModelLoader
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,13 +6,14 @@ import com.bumptech.glide.Glide
|
|||||||
import com.bumptech.glide.ListPreloader
|
import com.bumptech.glide.ListPreloader
|
||||||
import com.bumptech.glide.RequestBuilder
|
import com.bumptech.glide.RequestBuilder
|
||||||
import com.bumptech.glide.request.RequestOptions
|
import com.bumptech.glide.request.RequestOptions
|
||||||
import dagger.hilt.android.scopes.FragmentScoped
|
import dagger.assisted.Assisted
|
||||||
|
import dagger.assisted.AssistedFactory
|
||||||
|
import dagger.assisted.AssistedInject
|
||||||
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
||||||
import gq.kirmanak.mealient.logging.Logger
|
import gq.kirmanak.mealient.logging.Logger
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
class RecipePreloadModelProvider(
|
class RecipePreloadModelProvider @AssistedInject constructor(
|
||||||
private val adapter: PagingDataAdapter<RecipeSummaryEntity, *>,
|
@Assisted private val adapter: PagingDataAdapter<RecipeSummaryEntity, *>,
|
||||||
private val fragment: Fragment,
|
private val fragment: Fragment,
|
||||||
private val requestOptions: RequestOptions,
|
private val requestOptions: RequestOptions,
|
||||||
private val logger: Logger,
|
private val logger: Logger,
|
||||||
@@ -28,15 +29,9 @@ class RecipePreloadModelProvider(
|
|||||||
return Glide.with(fragment).load(item).apply(requestOptions)
|
return Glide.with(fragment).load(item).apply(requestOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
@FragmentScoped
|
@AssistedFactory
|
||||||
class Factory @Inject constructor(
|
interface Factory {
|
||||||
private val fragment: Fragment,
|
|
||||||
private val requestOptions: RequestOptions,
|
|
||||||
private val logger: Logger,
|
|
||||||
) {
|
|
||||||
|
|
||||||
fun create(
|
fun create(adapter: PagingDataAdapter<RecipeSummaryEntity, *>): RecipePreloadModelProvider
|
||||||
adapter: PagingDataAdapter<RecipeSummaryEntity, *>,
|
|
||||||
) = RecipePreloadModelProvider(adapter, fragment, requestOptions, logger)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,10 +20,9 @@ class RecipeInfoFragment : BottomSheetDialogFragment() {
|
|||||||
private val binding by viewBinding(FragmentRecipeInfoBinding::bind)
|
private val binding by viewBinding(FragmentRecipeInfoBinding::bind)
|
||||||
private val viewModel by viewModels<RecipeInfoViewModel>()
|
private val viewModel by viewModels<RecipeInfoViewModel>()
|
||||||
private lateinit var ingredientsAdapter: RecipeIngredientsAdapter
|
private lateinit var ingredientsAdapter: RecipeIngredientsAdapter
|
||||||
private val instructionsAdapter by lazy { recipeInstructionsAdapterFactory.build() }
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var recipeInstructionsAdapterFactory: RecipeInstructionsAdapter.Factory
|
lateinit var instructionsAdapter: RecipeInstructionsAdapter
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var recipeIngredientsAdapterFactory: RecipeIngredientsAdapter.Factory
|
lateinit var recipeIngredientsAdapterFactory: RecipeIngredientsAdapter.Factory
|
||||||
|
|||||||
@@ -7,50 +7,38 @@ import androidx.core.view.isGone
|
|||||||
import androidx.recyclerview.widget.DiffUtil
|
import androidx.recyclerview.widget.DiffUtil
|
||||||
import androidx.recyclerview.widget.ListAdapter
|
import androidx.recyclerview.widget.ListAdapter
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import dagger.assisted.Assisted
|
||||||
|
import dagger.assisted.AssistedFactory
|
||||||
|
import dagger.assisted.AssistedInject
|
||||||
import gq.kirmanak.mealient.database.recipe.entity.RecipeIngredientEntity
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeIngredientEntity
|
||||||
import gq.kirmanak.mealient.databinding.ViewHolderIngredientBinding
|
import gq.kirmanak.mealient.databinding.ViewHolderIngredientBinding
|
||||||
import gq.kirmanak.mealient.logging.Logger
|
import gq.kirmanak.mealient.logging.Logger
|
||||||
import gq.kirmanak.mealient.ui.recipes.info.RecipeIngredientsAdapter.RecipeIngredientViewHolder
|
import gq.kirmanak.mealient.ui.recipes.info.RecipeIngredientsAdapter.RecipeIngredientViewHolder
|
||||||
import javax.inject.Inject
|
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
class RecipeIngredientsAdapter private constructor(
|
class RecipeIngredientsAdapter @AssistedInject constructor(
|
||||||
private val recipeIngredientViewHolderFactory: RecipeIngredientViewHolder.Factory,
|
private val recipeIngredientViewHolderFactory: RecipeIngredientViewHolder.Factory,
|
||||||
private val logger: Logger,
|
private val logger: Logger,
|
||||||
private val disableAmounts: Boolean,
|
@Assisted private val disableAmounts: Boolean,
|
||||||
) : ListAdapter<RecipeIngredientEntity, RecipeIngredientViewHolder>(RecipeIngredientDiffCallback) {
|
) : ListAdapter<RecipeIngredientEntity, RecipeIngredientViewHolder>(RecipeIngredientDiffCallback) {
|
||||||
|
|
||||||
@Singleton
|
@AssistedFactory
|
||||||
class Factory @Inject constructor(
|
interface Factory {
|
||||||
private val recipeIngredientViewHolderFactory: RecipeIngredientViewHolder.Factory,
|
fun build(disableAmounts: Boolean): RecipeIngredientsAdapter
|
||||||
private val logger: Logger,
|
|
||||||
) {
|
|
||||||
fun build(disableAmounts: Boolean) = RecipeIngredientsAdapter(
|
|
||||||
recipeIngredientViewHolderFactory = recipeIngredientViewHolderFactory,
|
|
||||||
logger = logger,
|
|
||||||
disableAmounts = disableAmounts,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class RecipeIngredientViewHolder private constructor(
|
class RecipeIngredientViewHolder @AssistedInject constructor(
|
||||||
private val binding: ViewHolderIngredientBinding,
|
@Assisted private val binding: ViewHolderIngredientBinding,
|
||||||
|
@Assisted private val disableAmounts: Boolean,
|
||||||
private val logger: Logger,
|
private val logger: Logger,
|
||||||
private val disableAmounts: Boolean,
|
|
||||||
) : RecyclerView.ViewHolder(binding.root) {
|
) : RecyclerView.ViewHolder(binding.root) {
|
||||||
|
|
||||||
@Singleton
|
@AssistedFactory
|
||||||
class Factory @Inject constructor(
|
interface Factory {
|
||||||
private val logger: Logger,
|
|
||||||
) {
|
|
||||||
|
|
||||||
fun build(
|
fun build(
|
||||||
binding: ViewHolderIngredientBinding,
|
binding: ViewHolderIngredientBinding,
|
||||||
disableAmounts: Boolean,
|
disableAmounts: Boolean,
|
||||||
) = RecipeIngredientViewHolder(
|
): RecipeIngredientViewHolder
|
||||||
binding = binding,
|
|
||||||
logger = logger,
|
|
||||||
disableAmounts = disableAmounts,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun bind(item: RecipeIngredientEntity) {
|
fun bind(item: RecipeIngredientEntity) {
|
||||||
@@ -133,15 +121,18 @@ fun Double.mediantMethod(d: Int = 10, mixed: Boolean = true): Triple<Int, Int, I
|
|||||||
n1 += n2
|
n1 += n2
|
||||||
d2 = d + 1
|
d2 = d + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
d1 > d2 -> d2 = d + 1
|
d1 > d2 -> d2 = d + 1
|
||||||
else -> d1 = d + 1
|
else -> d1 = d + 1
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
x < m -> {
|
x < m -> {
|
||||||
n2 += n1
|
n2 += n1
|
||||||
d2 += d1
|
d2 += d1
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
n1 += n2
|
n1 += n2
|
||||||
d1 += d2
|
d1 += d2
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import android.view.ViewGroup
|
|||||||
import androidx.recyclerview.widget.DiffUtil
|
import androidx.recyclerview.widget.DiffUtil
|
||||||
import androidx.recyclerview.widget.ListAdapter
|
import androidx.recyclerview.widget.ListAdapter
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import dagger.assisted.Assisted
|
||||||
|
import dagger.assisted.AssistedFactory
|
||||||
|
import dagger.assisted.AssistedInject
|
||||||
import gq.kirmanak.mealient.R
|
import gq.kirmanak.mealient.R
|
||||||
import gq.kirmanak.mealient.database.recipe.entity.RecipeInstructionEntity
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeInstructionEntity
|
||||||
import gq.kirmanak.mealient.databinding.ViewHolderInstructionBinding
|
import gq.kirmanak.mealient.databinding.ViewHolderInstructionBinding
|
||||||
@@ -12,21 +15,12 @@ import gq.kirmanak.mealient.extensions.resources
|
|||||||
import gq.kirmanak.mealient.logging.Logger
|
import gq.kirmanak.mealient.logging.Logger
|
||||||
import gq.kirmanak.mealient.ui.recipes.info.RecipeInstructionsAdapter.RecipeInstructionViewHolder
|
import gq.kirmanak.mealient.ui.recipes.info.RecipeInstructionsAdapter.RecipeInstructionViewHolder
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
class RecipeInstructionsAdapter private constructor(
|
class RecipeInstructionsAdapter @Inject constructor(
|
||||||
private val logger: Logger,
|
private val logger: Logger,
|
||||||
private val recipeInstructionViewHolderFactory: RecipeInstructionViewHolder.Factory,
|
private val recipeInstructionViewHolderFactory: RecipeInstructionViewHolder.Factory,
|
||||||
) : ListAdapter<RecipeInstructionEntity, RecipeInstructionViewHolder>(RecipeInstructionDiffCallback) {
|
) : ListAdapter<RecipeInstructionEntity, RecipeInstructionViewHolder>(RecipeInstructionDiffCallback) {
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class Factory @Inject constructor(
|
|
||||||
private val logger: Logger,
|
|
||||||
private val recipeInstructionViewHolderFactory: RecipeInstructionViewHolder.Factory,
|
|
||||||
) {
|
|
||||||
fun build() = RecipeInstructionsAdapter(logger, recipeInstructionViewHolderFactory)
|
|
||||||
}
|
|
||||||
|
|
||||||
private object RecipeInstructionDiffCallback :
|
private object RecipeInstructionDiffCallback :
|
||||||
DiffUtil.ItemCallback<RecipeInstructionEntity>() {
|
DiffUtil.ItemCallback<RecipeInstructionEntity>() {
|
||||||
override fun areItemsTheSame(
|
override fun areItemsTheSame(
|
||||||
@@ -40,15 +34,14 @@ class RecipeInstructionsAdapter private constructor(
|
|||||||
): Boolean = oldItem == newItem
|
): Boolean = oldItem == newItem
|
||||||
}
|
}
|
||||||
|
|
||||||
class RecipeInstructionViewHolder private constructor(
|
class RecipeInstructionViewHolder @AssistedInject constructor(
|
||||||
private val binding: ViewHolderInstructionBinding,
|
@Assisted private val binding: ViewHolderInstructionBinding,
|
||||||
private val logger: Logger,
|
private val logger: Logger,
|
||||||
) : RecyclerView.ViewHolder(binding.root) {
|
) : RecyclerView.ViewHolder(binding.root) {
|
||||||
|
|
||||||
@Singleton
|
@AssistedFactory
|
||||||
class Factory @Inject constructor(private val logger: Logger) {
|
interface Factory {
|
||||||
fun build(binding: ViewHolderInstructionBinding) =
|
fun build(binding: ViewHolderInstructionBinding): RecipeInstructionViewHolder
|
||||||
RecipeInstructionViewHolder(binding, logger)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun bind(item: RecipeInstructionEntity, position: Int) {
|
fun bind(item: RecipeInstructionEntity, position: Int) {
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
package gq.kirmanak.mealient.architecture.configuration
|
package gq.kirmanak.mealient.architecture.configuration
|
||||||
|
|
||||||
|
import kotlinx.coroutines.CoroutineDispatcher
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class AppDispatchersImpl @Inject constructor() : AppDispatchers {
|
class AppDispatchersImpl @Inject constructor() : AppDispatchers {
|
||||||
|
|
||||||
override val io = Dispatchers.IO
|
override val io: CoroutineDispatcher get() = Dispatchers.IO
|
||||||
|
|
||||||
override val main = Dispatchers.Main
|
override val main: CoroutineDispatcher get() = Dispatchers.Main
|
||||||
|
|
||||||
override val default = Dispatchers.Default
|
override val default: CoroutineDispatcher get() = Dispatchers.Default
|
||||||
|
|
||||||
override val unconfined = Dispatchers.Unconfined
|
override val unconfined: CoroutineDispatcher get() = Dispatchers.Unconfined
|
||||||
}
|
}
|
||||||
@@ -4,13 +4,11 @@ import dagger.Binds
|
|||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.hilt.InstallIn
|
import dagger.hilt.InstallIn
|
||||||
import dagger.hilt.components.SingletonComponent
|
import dagger.hilt.components.SingletonComponent
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@InstallIn(SingletonComponent::class)
|
@InstallIn(SingletonComponent::class)
|
||||||
interface ArchitectureModule {
|
interface ArchitectureModule {
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindAppDispatchers(appDispatchersImpl: AppDispatchersImpl): AppDispatchers
|
fun bindAppDispatchers(appDispatchersImpl: AppDispatchersImpl): AppDispatchers
|
||||||
}
|
}
|
||||||
@@ -26,11 +26,9 @@ internal interface DatabaseModule {
|
|||||||
.build()
|
.build()
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
|
||||||
fun provideRecipeDao(db: AppDb): RecipeDao = db.recipeDao()
|
fun provideRecipeDao(db: AppDb): RecipeDao = db.recipeDao()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun provideRecipeStorage(recipeStorageImpl: RecipeStorageImpl): RecipeStorage
|
fun provideRecipeStorage(recipeStorageImpl: RecipeStorageImpl): RecipeStorage
|
||||||
}
|
}
|
||||||
@@ -10,9 +10,7 @@ import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity
|
|||||||
import gq.kirmanak.mealient.database.recipe.entity.RecipeWithSummaryAndIngredientsAndInstructions
|
import gq.kirmanak.mealient.database.recipe.entity.RecipeWithSummaryAndIngredientsAndInstructions
|
||||||
import gq.kirmanak.mealient.logging.Logger
|
import gq.kirmanak.mealient.logging.Logger
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
internal class RecipeStorageImpl @Inject constructor(
|
internal class RecipeStorageImpl @Inject constructor(
|
||||||
private val db: AppDb,
|
private val db: AppDb,
|
||||||
private val logger: Logger,
|
private val logger: Logger,
|
||||||
|
|||||||
@@ -14,13 +14,11 @@ import gq.kirmanak.mealient.datasource.BuildConfig
|
|||||||
import gq.kirmanak.mealient.logging.Logger
|
import gq.kirmanak.mealient.logging.Logger
|
||||||
import okhttp3.Interceptor
|
import okhttp3.Interceptor
|
||||||
import okhttp3.logging.HttpLoggingInterceptor
|
import okhttp3.logging.HttpLoggingInterceptor
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@InstallIn(SingletonComponent::class)
|
@InstallIn(SingletonComponent::class)
|
||||||
object DebugModule {
|
object DebugModule {
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
|
||||||
@IntoSet
|
@IntoSet
|
||||||
fun provideLoggingInterceptor(logger: Logger): Interceptor {
|
fun provideLoggingInterceptor(logger: Logger): Interceptor {
|
||||||
val interceptor = HttpLoggingInterceptor { message -> logger.v(tag = "OkHttp") { message } }
|
val interceptor = HttpLoggingInterceptor { message -> logger.v(tag = "OkHttp") { message } }
|
||||||
@@ -32,7 +30,6 @@ object DebugModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
|
||||||
@IntoSet
|
@IntoSet
|
||||||
fun provideChuckerInterceptor(@ApplicationContext context: Context): Interceptor {
|
fun provideChuckerInterceptor(@ApplicationContext context: Context): Interceptor {
|
||||||
val collector = ChuckerCollector(
|
val collector = ChuckerCollector(
|
||||||
|
|||||||
@@ -73,32 +73,25 @@ interface DataSourceModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindCacheBuilder(cacheBuilderImpl: CacheBuilderImpl): CacheBuilder
|
fun bindCacheBuilder(cacheBuilderImpl: CacheBuilderImpl): CacheBuilder
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindOkHttpBuilder(okHttpBuilderImpl: OkHttpBuilderImpl): OkHttpBuilder
|
fun bindOkHttpBuilder(okHttpBuilderImpl: OkHttpBuilderImpl): OkHttpBuilder
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindMealieDataSource(mealientDataSourceImpl: MealieDataSourceV0Impl): MealieDataSourceV0
|
fun bindMealieDataSource(mealientDataSourceImpl: MealieDataSourceV0Impl): MealieDataSourceV0
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindMealieDataSourceV1(mealientDataSourceImpl: MealieDataSourceV1Impl): MealieDataSourceV1
|
fun bindMealieDataSourceV1(mealientDataSourceImpl: MealieDataSourceV1Impl): MealieDataSourceV1
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindNetworkRequestWrapper(networkRequestWrapperImpl: NetworkRequestWrapperImpl): NetworkRequestWrapper
|
fun bindNetworkRequestWrapper(networkRequestWrapperImpl: NetworkRequestWrapperImpl): NetworkRequestWrapper
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
@IntoSet
|
@IntoSet
|
||||||
fun bindAuthInterceptor(authInterceptor: AuthInterceptor): LocalInterceptor
|
fun bindAuthInterceptor(authInterceptor: AuthInterceptor): LocalInterceptor
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
@IntoSet
|
@IntoSet
|
||||||
fun bindBaseUrlInterceptor(baseUrlInterceptor: BaseUrlInterceptor): LocalInterceptor
|
fun bindBaseUrlInterceptor(baseUrlInterceptor: BaseUrlInterceptor): LocalInterceptor
|
||||||
}
|
}
|
||||||
@@ -9,9 +9,7 @@ import okhttp3.Interceptor
|
|||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Provider
|
import javax.inject.Provider
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class AuthInterceptor @Inject constructor(
|
class AuthInterceptor @Inject constructor(
|
||||||
private val logger: Logger,
|
private val logger: Logger,
|
||||||
private val authenticationProviderProvider: Provider<AuthenticationProvider>,
|
private val authenticationProviderProvider: Provider<AuthenticationProvider>,
|
||||||
|
|||||||
@@ -10,9 +10,7 @@ import okhttp3.Response
|
|||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Provider
|
import javax.inject.Provider
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class BaseUrlInterceptor @Inject constructor(
|
class BaseUrlInterceptor @Inject constructor(
|
||||||
private val logger: Logger,
|
private val logger: Logger,
|
||||||
private val serverUrlProviderProvider: Provider<ServerUrlProvider>,
|
private val serverUrlProviderProvider: Provider<ServerUrlProvider>,
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ import gq.kirmanak.mealient.logging.Logger
|
|||||||
import okhttp3.Cache
|
import okhttp3.Cache
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class CacheBuilderImpl @Inject constructor(
|
class CacheBuilderImpl @Inject constructor(
|
||||||
@ApplicationContext private val context: Context,
|
@ApplicationContext private val context: Context,
|
||||||
private val logger: Logger,
|
private val logger: Logger,
|
||||||
|
|||||||
@@ -6,9 +6,7 @@ import gq.kirmanak.mealient.datasource.runCatchingExceptCancel
|
|||||||
import gq.kirmanak.mealient.logging.Logger
|
import gq.kirmanak.mealient.logging.Logger
|
||||||
import retrofit2.HttpException
|
import retrofit2.HttpException
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class NetworkRequestWrapperImpl @Inject constructor(
|
class NetworkRequestWrapperImpl @Inject constructor(
|
||||||
private val logger: Logger,
|
private val logger: Logger,
|
||||||
) : NetworkRequestWrapper {
|
) : NetworkRequestWrapper {
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ import gq.kirmanak.mealient.logging.Logger
|
|||||||
import okhttp3.Interceptor
|
import okhttp3.Interceptor
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class OkHttpBuilderImpl @Inject constructor(
|
class OkHttpBuilderImpl @Inject constructor(
|
||||||
private val cacheBuilder: CacheBuilder,
|
private val cacheBuilder: CacheBuilder,
|
||||||
// Use @JvmSuppressWildcards because otherwise dagger can't inject it (https://stackoverflow.com/a/43149382)
|
// Use @JvmSuppressWildcards because otherwise dagger can't inject it (https://stackoverflow.com/a/43149382)
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ import okhttp3.OkHttpClient
|
|||||||
import retrofit2.Converter.Factory
|
import retrofit2.Converter.Factory
|
||||||
import retrofit2.Retrofit
|
import retrofit2.Retrofit
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class RetrofitBuilder @Inject constructor(
|
class RetrofitBuilder @Inject constructor(
|
||||||
private val okHttpClient: OkHttpClient,
|
private val okHttpClient: OkHttpClient,
|
||||||
private val converterFactory: Factory,
|
private val converterFactory: Factory,
|
||||||
|
|||||||
@@ -18,9 +18,7 @@ import retrofit2.HttpException
|
|||||||
import java.net.ConnectException
|
import java.net.ConnectException
|
||||||
import java.net.SocketTimeoutException
|
import java.net.SocketTimeoutException
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class MealieDataSourceV0Impl @Inject constructor(
|
class MealieDataSourceV0Impl @Inject constructor(
|
||||||
private val networkRequestWrapper: NetworkRequestWrapper,
|
private val networkRequestWrapper: NetworkRequestWrapper,
|
||||||
private val service: MealieServiceV0,
|
private val service: MealieServiceV0,
|
||||||
|
|||||||
@@ -27,9 +27,7 @@ import retrofit2.HttpException
|
|||||||
import java.net.ConnectException
|
import java.net.ConnectException
|
||||||
import java.net.SocketTimeoutException
|
import java.net.SocketTimeoutException
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class MealieDataSourceV1Impl @Inject constructor(
|
class MealieDataSourceV1Impl @Inject constructor(
|
||||||
private val networkRequestWrapper: NetworkRequestWrapper,
|
private val networkRequestWrapper: NetworkRequestWrapper,
|
||||||
private val service: MealieServiceV1,
|
private val service: MealieServiceV1,
|
||||||
|
|||||||
@@ -15,6 +15,5 @@ object ReleaseModule {
|
|||||||
// is required by Dagger, so an empty Set is provided here
|
// is required by Dagger, so an empty Set is provided here
|
||||||
// Use @JvmSuppressWildcards because otherwise dagger can't inject it (https://stackoverflow.com/a/43149382)
|
// Use @JvmSuppressWildcards because otherwise dagger can't inject it (https://stackoverflow.com/a/43149382)
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
|
||||||
fun provideInterceptors(): Set<@JvmSuppressWildcards Interceptor> = emptySet()
|
fun provideInterceptors(): Set<@JvmSuppressWildcards Interceptor> = emptySet()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ import gq.kirmanak.mealient.logging.Logger
|
|||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class AddRecipeStorageImpl @Inject constructor(
|
class AddRecipeStorageImpl @Inject constructor(
|
||||||
private val dataStore: DataStore<AddRecipeInput>,
|
private val dataStore: DataStore<AddRecipeInput>,
|
||||||
private val logger: Logger,
|
private val logger: Logger,
|
||||||
|
|||||||
@@ -10,18 +10,15 @@ import gq.kirmanak.mealient.shopping_lists.repo.ShoppingListsRepo
|
|||||||
import gq.kirmanak.mealient.shopping_lists.repo.ShoppingListsRepoImpl
|
import gq.kirmanak.mealient.shopping_lists.repo.ShoppingListsRepoImpl
|
||||||
import gq.kirmanak.mealient.shopping_lists.util.LoadingHelperFactory
|
import gq.kirmanak.mealient.shopping_lists.util.LoadingHelperFactory
|
||||||
import gq.kirmanak.mealient.shopping_lists.util.LoadingHelperFactoryImpl
|
import gq.kirmanak.mealient.shopping_lists.util.LoadingHelperFactoryImpl
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@InstallIn(SingletonComponent::class)
|
@InstallIn(SingletonComponent::class)
|
||||||
interface ShoppingListsModule {
|
interface ShoppingListsModule {
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindShoppingListsDataSource(impl: ShoppingListsDataSourceImpl): ShoppingListsDataSource
|
fun bindShoppingListsDataSource(impl: ShoppingListsDataSourceImpl): ShoppingListsDataSource
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindShoppingListsRepo(impl: ShoppingListsRepoImpl): ShoppingListsRepo
|
fun bindShoppingListsRepo(impl: ShoppingListsRepoImpl): ShoppingListsRepo
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ import gq.kirmanak.mealient.datasource.models.ShoppingListInfo
|
|||||||
import gq.kirmanak.mealient.datasource.v1.MealieDataSourceV1
|
import gq.kirmanak.mealient.datasource.v1.MealieDataSourceV1
|
||||||
import gq.kirmanak.mealient.model_mapper.ModelMapper
|
import gq.kirmanak.mealient.model_mapper.ModelMapper
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class ShoppingListsDataSourceImpl @Inject constructor(
|
class ShoppingListsDataSourceImpl @Inject constructor(
|
||||||
private val v1Source: MealieDataSourceV1,
|
private val v1Source: MealieDataSourceV1,
|
||||||
private val modelMapper: ModelMapper,
|
private val modelMapper: ModelMapper,
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ import gq.kirmanak.mealient.datasource.models.ShoppingListInfo
|
|||||||
import gq.kirmanak.mealient.logging.Logger
|
import gq.kirmanak.mealient.logging.Logger
|
||||||
import gq.kirmanak.mealient.shopping_lists.network.ShoppingListsDataSource
|
import gq.kirmanak.mealient.shopping_lists.network.ShoppingListsDataSource
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class ShoppingListsRepoImpl @Inject constructor(
|
class ShoppingListsRepoImpl @Inject constructor(
|
||||||
private val dataSource: ShoppingListsDataSource,
|
private val dataSource: ShoppingListsDataSource,
|
||||||
private val logger: Logger,
|
private val logger: Logger,
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ package gq.kirmanak.mealient.logging
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import gq.kirmanak.mealient.architecture.configuration.BuildConfiguration
|
import gq.kirmanak.mealient.architecture.configuration.BuildConfiguration
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class LogcatAppender @Inject constructor(
|
class LogcatAppender @Inject constructor(
|
||||||
private val buildConfiguration: BuildConfiguration,
|
private val buildConfiguration: BuildConfiguration,
|
||||||
) : Appender {
|
) : Appender {
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ package gq.kirmanak.mealient.logging
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class LoggerImpl @Inject constructor(
|
class LoggerImpl @Inject constructor(
|
||||||
private val appenders: Set<@JvmSuppressWildcards Appender>,
|
private val appenders: Set<@JvmSuppressWildcards Appender>,
|
||||||
) : Logger {
|
) : Logger {
|
||||||
|
|||||||
@@ -5,18 +5,15 @@ import dagger.Module
|
|||||||
import dagger.hilt.InstallIn
|
import dagger.hilt.InstallIn
|
||||||
import dagger.hilt.components.SingletonComponent
|
import dagger.hilt.components.SingletonComponent
|
||||||
import dagger.multibindings.IntoSet
|
import dagger.multibindings.IntoSet
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@InstallIn(SingletonComponent::class)
|
@InstallIn(SingletonComponent::class)
|
||||||
interface LoggingModule {
|
interface LoggingModule {
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindLogger(loggerImpl: LoggerImpl): Logger
|
fun bindLogger(loggerImpl: LoggerImpl): Logger
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
@IntoSet
|
@IntoSet
|
||||||
fun bindLogcatAppender(logcatAppender: LogcatAppender): Appender
|
fun bindLogcatAppender(logcatAppender: LogcatAppender): Appender
|
||||||
}
|
}
|
||||||
@@ -50,9 +50,7 @@ import gq.kirmanak.mealient.datasource.v1.models.VersionResponseV1
|
|||||||
import gq.kirmanak.mealient.datastore.recipe.AddRecipeDraft
|
import gq.kirmanak.mealient.datastore.recipe.AddRecipeDraft
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class ModelMapperImpl @Inject constructor() : ModelMapper {
|
class ModelMapperImpl @Inject constructor() : ModelMapper {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,11 @@ import dagger.Binds
|
|||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.hilt.InstallIn
|
import dagger.hilt.InstallIn
|
||||||
import dagger.hilt.components.SingletonComponent
|
import dagger.hilt.components.SingletonComponent
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@InstallIn(SingletonComponent::class)
|
@InstallIn(SingletonComponent::class)
|
||||||
interface ModelMapperModule {
|
interface ModelMapperModule {
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindModelMapper(impl: ModelMapperImpl): ModelMapper
|
fun bindModelMapper(impl: ModelMapperImpl): ModelMapper
|
||||||
}
|
}
|
||||||
@@ -3,9 +3,7 @@ package gq.kirmanak.mealient.test
|
|||||||
import gq.kirmanak.mealient.logging.Logger
|
import gq.kirmanak.mealient.logging.Logger
|
||||||
import gq.kirmanak.mealient.logging.MessageSupplier
|
import gq.kirmanak.mealient.logging.MessageSupplier
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class FakeLogger @Inject constructor() : Logger {
|
class FakeLogger @Inject constructor() : Logger {
|
||||||
override fun v(throwable: Throwable?, tag: String?, messageSupplier: MessageSupplier) {
|
override fun v(throwable: Throwable?, tag: String?, messageSupplier: MessageSupplier) {
|
||||||
print("V", throwable, messageSupplier)
|
print("V", throwable, messageSupplier)
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import dagger.hilt.components.SingletonComponent
|
|||||||
import dagger.hilt.testing.TestInstallIn
|
import dagger.hilt.testing.TestInstallIn
|
||||||
import gq.kirmanak.mealient.logging.Logger
|
import gq.kirmanak.mealient.logging.Logger
|
||||||
import gq.kirmanak.mealient.logging.LoggingModule
|
import gq.kirmanak.mealient.logging.LoggingModule
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@TestInstallIn(
|
@TestInstallIn(
|
||||||
@@ -16,6 +15,5 @@ import javax.inject.Singleton
|
|||||||
interface FakeLoggingModule {
|
interface FakeLoggingModule {
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindFakeLogger(impl: FakeLogger): Logger
|
fun bindFakeLogger(impl: FakeLogger): Logger
|
||||||
}
|
}
|
||||||
@@ -4,13 +4,11 @@ import dagger.Binds
|
|||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.hilt.InstallIn
|
import dagger.hilt.InstallIn
|
||||||
import dagger.hilt.components.SingletonComponent
|
import dagger.hilt.components.SingletonComponent
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@InstallIn(SingletonComponent::class)
|
@InstallIn(SingletonComponent::class)
|
||||||
interface UiModule {
|
interface UiModule {
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@Singleton
|
|
||||||
fun bindActivityUiStateController(impl: ActivityUiStateControllerImpl): ActivityUiStateController
|
fun bindActivityUiStateController(impl: ActivityUiStateControllerImpl): ActivityUiStateController
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user