From c36a03d72690c50a65981ff008e87bacecd2b96c Mon Sep 17 00:00:00 2001 From: Thomas Kioko Date: Sat, 7 Dec 2024 16:19:55 +0100 Subject: [PATCH] Add missing scopes. Forgot these during the migration. --- .../com/thomaskioko/tvmaniac/core/base/di/BaseComponent.kt | 2 ++ .../tvmaniac/core/logger/inject/LoggingComponent.kt | 2 ++ .../thomaskioko/tvmaniac/util/inject/UtilPlatformComponent.kt | 2 ++ .../thomaskioko/tvmaniac/util/inject/UtilPlatformComponent.kt | 2 ++ .../com/thomaskioko/tvmaniac/db/DatabasePlatformComponent.kt | 2 ++ .../com/thomaskioko/tvmaniac/db/DatabasePlatformComponent.kt | 2 ++ .../datastore/implementation/DataStorePlatformComponent.kt | 2 ++ .../datastore/implementation/DataStorePlatformComponent.kt | 1 + .../tvmaniac/tmdb/implementation/TmdbPlatformComponent.kt | 2 ++ .../thomaskioko/tvmaniac/tmdb/implementation/TmdbComponent.kt | 3 +++ .../tvmaniac/tmdb/implementation/TmdbPlatformComponent.kt | 2 ++ 11 files changed, 22 insertions(+) diff --git a/core/base/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/base/di/BaseComponent.kt b/core/base/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/base/di/BaseComponent.kt index c097490c2..b73360ebc 100644 --- a/core/base/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/base/di/BaseComponent.kt +++ b/core/base/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/base/di/BaseComponent.kt @@ -5,11 +5,13 @@ import kotlinx.coroutines.Dispatchers import me.tatarka.inject.annotations.Provides import software.amazon.lastmile.kotlin.inject.anvil.AppScope import software.amazon.lastmile.kotlin.inject.anvil.ContributesTo +import software.amazon.lastmile.kotlin.inject.anvil.SingleIn @ContributesTo(AppScope::class) interface BaseComponent { @Provides + @SingleIn(AppScope::class) fun provideCoroutineDispatchers(): AppCoroutineDispatchers = AppCoroutineDispatchers( io = Dispatchers.Default, diff --git a/core/logger/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/logger/inject/LoggingComponent.kt b/core/logger/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/logger/inject/LoggingComponent.kt index 1264e78c2..08785e20f 100644 --- a/core/logger/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/logger/inject/LoggingComponent.kt +++ b/core/logger/src/commonMain/kotlin/com/thomaskioko/tvmaniac/core/logger/inject/LoggingComponent.kt @@ -5,11 +5,13 @@ import com.thomaskioko.tvmaniac.core.logger.KermitLogger import me.tatarka.inject.annotations.Provides import software.amazon.lastmile.kotlin.inject.anvil.AppScope import software.amazon.lastmile.kotlin.inject.anvil.ContributesTo +import software.amazon.lastmile.kotlin.inject.anvil.SingleIn @ContributesTo(AppScope::class) interface LoggingComponent { @Provides + @SingleIn(AppScope::class) fun provideKermitLogger( configs: Configs, ): KermitLogger = KermitLogger(configs.isDebug) diff --git a/core/util/src/androidMain/kotlin/com/thomaskioko/tvmaniac/util/inject/UtilPlatformComponent.kt b/core/util/src/androidMain/kotlin/com/thomaskioko/tvmaniac/util/inject/UtilPlatformComponent.kt index 01c5f09f0..7f5b41d9b 100644 --- a/core/util/src/androidMain/kotlin/com/thomaskioko/tvmaniac/util/inject/UtilPlatformComponent.kt +++ b/core/util/src/androidMain/kotlin/com/thomaskioko/tvmaniac/util/inject/UtilPlatformComponent.kt @@ -5,11 +5,13 @@ import com.thomaskioko.tvmaniac.util.YamlResourceReader import me.tatarka.inject.annotations.Provides import software.amazon.lastmile.kotlin.inject.anvil.AppScope import software.amazon.lastmile.kotlin.inject.anvil.ContributesTo +import software.amazon.lastmile.kotlin.inject.anvil.SingleIn @ContributesTo(AppScope::class) interface UtilPlatformComponent { @Provides + @SingleIn(AppScope::class) fun provideConfigs(resourceReader: YamlResourceReader): Configs = resourceReader.readAndDecodeResource("config.yaml", Configs.serializer()) } diff --git a/core/util/src/iosMain/kotlin/com/thomaskioko/tvmaniac/util/inject/UtilPlatformComponent.kt b/core/util/src/iosMain/kotlin/com/thomaskioko/tvmaniac/util/inject/UtilPlatformComponent.kt index a87853e90..ef8fb9287 100644 --- a/core/util/src/iosMain/kotlin/com/thomaskioko/tvmaniac/util/inject/UtilPlatformComponent.kt +++ b/core/util/src/iosMain/kotlin/com/thomaskioko/tvmaniac/util/inject/UtilPlatformComponent.kt @@ -5,11 +5,13 @@ import com.thomaskioko.tvmaniac.util.YamlResourceReader import me.tatarka.inject.annotations.Provides import software.amazon.lastmile.kotlin.inject.anvil.AppScope import software.amazon.lastmile.kotlin.inject.anvil.ContributesTo +import software.amazon.lastmile.kotlin.inject.anvil.SingleIn @ContributesTo(AppScope::class) interface UtilPlatformComponent { @Provides + @SingleIn(AppScope::class) fun provideConfigs(resourceReader: YamlResourceReader): Configs = resourceReader.readAndDecodeResource("config.yaml", Configs.serializer()) diff --git a/database/src/androidMain/kotlin/com/thomaskioko/tvmaniac/db/DatabasePlatformComponent.kt b/database/src/androidMain/kotlin/com/thomaskioko/tvmaniac/db/DatabasePlatformComponent.kt index 93574f7aa..105e81f19 100644 --- a/database/src/androidMain/kotlin/com/thomaskioko/tvmaniac/db/DatabasePlatformComponent.kt +++ b/database/src/androidMain/kotlin/com/thomaskioko/tvmaniac/db/DatabasePlatformComponent.kt @@ -7,11 +7,13 @@ import com.thomaskioko.tvmaniac.core.db.TvManiacDatabase import me.tatarka.inject.annotations.Provides import software.amazon.lastmile.kotlin.inject.anvil.AppScope import software.amazon.lastmile.kotlin.inject.anvil.ContributesTo +import software.amazon.lastmile.kotlin.inject.anvil.SingleIn @ContributesTo(AppScope::class) interface DatabasePlatformComponent { @Provides + @SingleIn(AppScope::class) fun provideSqlDriver(application: Application): SqlDriver = AndroidSqliteDriver( schema = TvManiacDatabase.Schema, diff --git a/database/src/iosMain/kotlin/com/thomaskioko/tvmaniac/db/DatabasePlatformComponent.kt b/database/src/iosMain/kotlin/com/thomaskioko/tvmaniac/db/DatabasePlatformComponent.kt index 22fe15124..682dcb035 100644 --- a/database/src/iosMain/kotlin/com/thomaskioko/tvmaniac/db/DatabasePlatformComponent.kt +++ b/database/src/iosMain/kotlin/com/thomaskioko/tvmaniac/db/DatabasePlatformComponent.kt @@ -6,10 +6,12 @@ import com.thomaskioko.tvmaniac.core.db.TvManiacDatabase import me.tatarka.inject.annotations.Provides import software.amazon.lastmile.kotlin.inject.anvil.AppScope import software.amazon.lastmile.kotlin.inject.anvil.ContributesTo +import software.amazon.lastmile.kotlin.inject.anvil.SingleIn @ContributesTo(AppScope::class) interface DatabasePlatformComponent { @Provides + @SingleIn(AppScope::class) fun provideSqlDriver(): SqlDriver = NativeSqliteDriver(TvManiacDatabase.Schema, "tvShows.db") } diff --git a/datastore/implementation/src/androidMain/kotlin/com/thomaskioko/tvmaniac/datastore/implementation/DataStorePlatformComponent.kt b/datastore/implementation/src/androidMain/kotlin/com/thomaskioko/tvmaniac/datastore/implementation/DataStorePlatformComponent.kt index 1cd665859..b4540d064 100644 --- a/datastore/implementation/src/androidMain/kotlin/com/thomaskioko/tvmaniac/datastore/implementation/DataStorePlatformComponent.kt +++ b/datastore/implementation/src/androidMain/kotlin/com/thomaskioko/tvmaniac/datastore/implementation/DataStorePlatformComponent.kt @@ -7,11 +7,13 @@ import com.thomaskioko.tvmaniac.core.base.model.AppCoroutineScope import me.tatarka.inject.annotations.Provides import software.amazon.lastmile.kotlin.inject.anvil.AppScope import software.amazon.lastmile.kotlin.inject.anvil.ContributesTo +import software.amazon.lastmile.kotlin.inject.anvil.SingleIn @ContributesTo(AppScope::class) interface DataStorePlatformComponent { @Provides + @SingleIn(AppScope::class) fun provideDataStore(context: Application, scope: AppCoroutineScope): DataStore = createDataStore( coroutineScope = scope.io, diff --git a/datastore/implementation/src/iosMain/kotlin/com/thomaskioko/tvmaniac/datastore/implementation/DataStorePlatformComponent.kt b/datastore/implementation/src/iosMain/kotlin/com/thomaskioko/tvmaniac/datastore/implementation/DataStorePlatformComponent.kt index 5b4bd760c..2da1c083f 100644 --- a/datastore/implementation/src/iosMain/kotlin/com/thomaskioko/tvmaniac/datastore/implementation/DataStorePlatformComponent.kt +++ b/datastore/implementation/src/iosMain/kotlin/com/thomaskioko/tvmaniac/datastore/implementation/DataStorePlatformComponent.kt @@ -16,6 +16,7 @@ import software.amazon.lastmile.kotlin.inject.anvil.SingleIn interface DataStorePlatformComponent { @Provides + @SingleIn(AppScope::class) fun provideDataStore(dispatchers: AppCoroutineScope): DataStore = createDataStore( coroutineScope = dispatchers.io, diff --git a/tmdb-api/implementation/src/androidMain/kotlin/com/thomaskioko/tvmaniac/tmdb/implementation/TmdbPlatformComponent.kt b/tmdb-api/implementation/src/androidMain/kotlin/com/thomaskioko/tvmaniac/tmdb/implementation/TmdbPlatformComponent.kt index d12c1a322..4f909d8ac 100644 --- a/tmdb-api/implementation/src/androidMain/kotlin/com/thomaskioko/tvmaniac/tmdb/implementation/TmdbPlatformComponent.kt +++ b/tmdb-api/implementation/src/androidMain/kotlin/com/thomaskioko/tvmaniac/tmdb/implementation/TmdbPlatformComponent.kt @@ -4,10 +4,12 @@ import io.ktor.client.engine.okhttp.OkHttp import me.tatarka.inject.annotations.Provides import software.amazon.lastmile.kotlin.inject.anvil.AppScope import software.amazon.lastmile.kotlin.inject.anvil.ContributesTo +import software.amazon.lastmile.kotlin.inject.anvil.SingleIn @ContributesTo(AppScope::class) interface TmdbPlatformComponent { @Provides + @SingleIn(AppScope::class) fun provideTmdbHttpClientEngine(): TmdbHttpClientEngine = OkHttp.create() } diff --git a/tmdb-api/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/tmdb/implementation/TmdbComponent.kt b/tmdb-api/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/tmdb/implementation/TmdbComponent.kt index 9b0f1e86c..7505e3d72 100644 --- a/tmdb-api/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/tmdb/implementation/TmdbComponent.kt +++ b/tmdb-api/implementation/src/commonMain/kotlin/com/thomaskioko/tvmaniac/tmdb/implementation/TmdbComponent.kt @@ -11,6 +11,7 @@ import kotlinx.serialization.json.Json import me.tatarka.inject.annotations.Provides import software.amazon.lastmile.kotlin.inject.anvil.AppScope import software.amazon.lastmile.kotlin.inject.anvil.ContributesTo +import software.amazon.lastmile.kotlin.inject.anvil.SingleIn typealias TmdbHttpClient = HttpClient @@ -22,6 +23,7 @@ typealias TmdbJson = Json interface TmdbComponent { @Provides + @SingleIn(AppScope::class) fun provideTmdbJson(): TmdbJson = Json { isLenient = true ignoreUnknownKeys = true @@ -30,6 +32,7 @@ interface TmdbComponent { } @Provides + @SingleIn(AppScope::class) fun provideTmdbHttpClient( configs: Configs, json: TmdbJson, diff --git a/tmdb-api/implementation/src/iosMain/kotlin/com/thomaskioko/tvmaniac/tmdb/implementation/TmdbPlatformComponent.kt b/tmdb-api/implementation/src/iosMain/kotlin/com/thomaskioko/tvmaniac/tmdb/implementation/TmdbPlatformComponent.kt index 2f7f55462..ebbd91f0d 100644 --- a/tmdb-api/implementation/src/iosMain/kotlin/com/thomaskioko/tvmaniac/tmdb/implementation/TmdbPlatformComponent.kt +++ b/tmdb-api/implementation/src/iosMain/kotlin/com/thomaskioko/tvmaniac/tmdb/implementation/TmdbPlatformComponent.kt @@ -4,10 +4,12 @@ import io.ktor.client.engine.darwin.Darwin import me.tatarka.inject.annotations.Provides import software.amazon.lastmile.kotlin.inject.anvil.AppScope import software.amazon.lastmile.kotlin.inject.anvil.ContributesTo +import software.amazon.lastmile.kotlin.inject.anvil.SingleIn @ContributesTo(AppScope::class) interface TmdbPlatformComponent { @Provides + @SingleIn(AppScope::class) fun provideTmdbHttpClientEngine(): TmdbHttpClientEngine = Darwin.create() }