From fabac3cf5b0a015367d9f17412d758ba682c40a3 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 10 Jan 2025 13:08:12 +0500 Subject: [PATCH] Updated on 2026-08-14 --- .../configs/feature_toggles_config.json | 4 ++++ features/swap/api/build.gradle.kts | 12 ++--------- .../features/swap/SwapFeatureToggles.kt | 5 +++++ features/swap/presentation/build.gradle.kts | 1 + .../feature/swap/DefaultSwapFeatureToggles.kt | 11 ++++++++++ .../feature/swap/di/SwapFeatureModule.kt | 21 +++++++++++++++++++ 6 files changed, 44 insertions(+), 10 deletions(-) create mode 100644 features/swap/api/src/main/kotlin/com/tangem/features/swap/SwapFeatureToggles.kt create mode 100644 features/swap/presentation/src/main/java/com/tangem/feature/swap/DefaultSwapFeatureToggles.kt create mode 100644 features/swap/presentation/src/main/java/com/tangem/feature/swap/di/SwapFeatureModule.kt diff --git a/core/config-toggles/src/main/assets/configs/feature_toggles_config.json b/core/config-toggles/src/main/assets/configs/feature_toggles_config.json index 60580e40b7..6b82c24e67 100644 --- a/core/config-toggles/src/main/assets/configs/feature_toggles_config.json +++ b/core/config-toggles/src/main/assets/configs/feature_toggles_config.json @@ -26,5 +26,9 @@ { "name": "NAVIGATION_REFACTORING", "version": "undefined" + }, + { + "name": "SWAP_STORIES_ENABLED", + "version": "undefined" } ] diff --git a/features/swap/api/build.gradle.kts b/features/swap/api/build.gradle.kts index 76bb25817f..099edf86ca 100644 --- a/features/swap/api/build.gradle.kts +++ b/features/swap/api/build.gradle.kts @@ -1,18 +1,10 @@ plugins { alias(deps.plugins.android.library) alias(deps.plugins.kotlin.android) - alias(deps.plugins.kotlin.kapt) - alias(deps.plugins.kotlin.serialization) - alias(deps.plugins.hilt.android) + id("kotlin-parcelize") id("configuration") } android { - namespace = "com.tangem.feature.swap.api" -} - -dependencies { - /** DI */ - implementation(deps.hilt.android) - kapt(deps.hilt.kapt) + namespace = "com.tangem.features.swap.api" } \ No newline at end of file diff --git a/features/swap/api/src/main/kotlin/com/tangem/features/swap/SwapFeatureToggles.kt b/features/swap/api/src/main/kotlin/com/tangem/features/swap/SwapFeatureToggles.kt new file mode 100644 index 0000000000..f43c34f8ac --- /dev/null +++ b/features/swap/api/src/main/kotlin/com/tangem/features/swap/SwapFeatureToggles.kt @@ -0,0 +1,5 @@ +package com.tangem.features.swap + +interface SwapFeatureToggles { + val isPromoStoriesEnabled: Boolean +} \ No newline at end of file diff --git a/features/swap/presentation/build.gradle.kts b/features/swap/presentation/build.gradle.kts index bd52ee999a..dfd97b9d99 100644 --- a/features/swap/presentation/build.gradle.kts +++ b/features/swap/presentation/build.gradle.kts @@ -44,6 +44,7 @@ dependencies { implementation(projects.features.swap.domain.api) implementation(projects.features.swap.domain.models) implementation(projects.features.wallet.api) + implementation(projects.features.swap.api) /** AndroidX */ implementation(deps.androidx.activity.compose) diff --git a/features/swap/presentation/src/main/java/com/tangem/feature/swap/DefaultSwapFeatureToggles.kt b/features/swap/presentation/src/main/java/com/tangem/feature/swap/DefaultSwapFeatureToggles.kt new file mode 100644 index 0000000000..cd341751d8 --- /dev/null +++ b/features/swap/presentation/src/main/java/com/tangem/feature/swap/DefaultSwapFeatureToggles.kt @@ -0,0 +1,11 @@ +package com.tangem.feature.swap + +import com.tangem.core.configtoggle.feature.FeatureTogglesManager +import com.tangem.features.swap.SwapFeatureToggles + +internal class DefaultSwapFeatureToggles( + private val featureToggles: FeatureTogglesManager, +) : SwapFeatureToggles { + override val isPromoStoriesEnabled: Boolean + get() = featureToggles.isFeatureEnabled("SWAP_STORIES_ENABLED") +} \ No newline at end of file diff --git a/features/swap/presentation/src/main/java/com/tangem/feature/swap/di/SwapFeatureModule.kt b/features/swap/presentation/src/main/java/com/tangem/feature/swap/di/SwapFeatureModule.kt new file mode 100644 index 0000000000..f2b92be438 --- /dev/null +++ b/features/swap/presentation/src/main/java/com/tangem/feature/swap/di/SwapFeatureModule.kt @@ -0,0 +1,21 @@ +package com.tangem.feature.swap.di + +import com.tangem.core.configtoggle.feature.FeatureTogglesManager +import com.tangem.feature.swap.DefaultSwapFeatureToggles +import com.tangem.features.swap.SwapFeatureToggles +import dagger.Module +import dagger.Provides +import dagger.hilt.InstallIn +import dagger.hilt.components.SingletonComponent +import javax.inject.Singleton + +@Module +@InstallIn(SingletonComponent::class) +internal object SwapFeatureModule { + + @Provides + @Singleton + fun provideSwapFeatureToggles(featureToggles: FeatureTogglesManager): SwapFeatureToggles { + return DefaultSwapFeatureToggles(featureToggles) + } +} \ No newline at end of file