From 61ad9e7bb430e6f2aca04c1b10688353bff13e92 Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 29 Jun 2026 15:57:04 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../kotlin/com/tangem/common/BaseTestCase.kt | 2 -- .../configs/feature_toggles_config.json | 4 ---- .../domain/GetMultiWalletWarningsFactory.kt | 3 --- .../GetWalletNotificationsCarouselFactory.kt | 3 --- ...tWalletNotificationsCarouselFactoryTest.kt | 15 +++---------- .../supply/api/YieldSupplyFeatureToggles.kt | 5 ----- .../impl/DefaultYieldSupplyFeatureToggles.kt | 15 ------------- .../active/model/YieldSupplyActiveModel.kt | 3 --- .../impl/di/YieldSupplyFeatureModule.kt | 21 ------------------- .../impl/entry/model/YieldSupplyEntryModel.kt | 5 +---- .../impl/main/model/YieldSupplyModel.kt | 7 ++----- .../YieldSupplyActiveModelBoostBlockTest.kt | 14 ------------- .../entry/model/YieldSupplyEntryModelTest.kt | 21 +------------------ .../impl/main/model/YieldSupplyModelTest.kt | 5 ----- 14 files changed, 7 insertions(+), 116 deletions(-) delete mode 100644 features/yield-supply/api/src/main/java/com/tangem/features/yield/supply/api/YieldSupplyFeatureToggles.kt delete mode 100644 features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/DefaultYieldSupplyFeatureToggles.kt delete mode 100644 features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/di/YieldSupplyFeatureModule.kt diff --git a/app/src/androidTest/kotlin/com/tangem/common/BaseTestCase.kt b/app/src/androidTest/kotlin/com/tangem/common/BaseTestCase.kt index 95ccc3e96a..f9bbb9d7cb 100644 --- a/app/src/androidTest/kotlin/com/tangem/common/BaseTestCase.kt +++ b/app/src/androidTest/kotlin/com/tangem/common/BaseTestCase.kt @@ -207,8 +207,6 @@ abstract class BaseTestCase : TestCase( "AND_15103_SWAP_RATE_EXPERIENCE_ENABLED" to true, "AND_15122_SWAP_PREDEFINED_BUTTONS_ENABLED" to true, "TWI_1512_HIDE_STORIES_FOR_REFERRAL_ENABLED" to true, - // 5.39.2 - "AND_15154_YIELD_PROMO_ENABLED" to true, // 5.40 "TWI_1377_MANAGE_FUNDS" to true, // 6.0 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 4504deb187..17d74b9d0c 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 @@ -115,10 +115,6 @@ "name": "AND_15122_SWAP_PREDEFINED_BUTTONS_ENABLED", "version": "5.39" }, - { - "name": "AND_15154_YIELD_PROMO_ENABLED", - "version": "5.39.2" - }, { "name": "TWI_1512_HIDE_STORIES_FOR_REFERRAL_ENABLED", "version": "5.39" diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetMultiWalletWarningsFactory.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetMultiWalletWarningsFactory.kt index 4b9931244c..e628ea2581 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetMultiWalletWarningsFactory.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetMultiWalletWarningsFactory.kt @@ -39,7 +39,6 @@ import com.tangem.feature.wallet.presentation.account.AccountDependencies import com.tangem.feature.wallet.presentation.wallet.state.model.WalletNotification import com.tangem.features.hotwallet.HotWalletFeatureToggles import com.tangem.features.wallet.featuretoggles.WalletFeatureToggles -import com.tangem.features.yield.supply.api.YieldSupplyFeatureToggles import com.tangem.hot.sdk.model.HotWalletId import com.tangem.lib.crypto.BlockchainUtils import com.tangem.utils.annotations.RemoveWithToggle @@ -70,7 +69,6 @@ internal class GetMultiWalletWarningsFactory @Inject constructor( private val hotWalletFeatureToggles: HotWalletFeatureToggles, private val shouldShowYieldBoostMainBannerUseCase: ShouldShowYieldBoostMainBannerUseCase, private val yieldSupplyGetShouldShowMainPromoUseCase: YieldSupplyGetShouldShowMainPromoUseCase, - private val yieldSupplyFeatureToggles: YieldSupplyFeatureToggles, private val designFeatureToggles: DesignFeatureToggles, private val walletFeatureToggles: WalletFeatureToggles, ) { @@ -208,7 +206,6 @@ internal class GetMultiWalletWarningsFactory @Inject constructor( clickIntents: WalletClickIntents, ) { if (!shouldShowLocal) return - if (!yieldSupplyFeatureToggles.isYieldPromoEnabled) return if (designFeatureToggles.isRedesignEnabled) return val shouldShow = shouldShowYieldBoostMainBannerUseCase(userWallet.walletId).getOrNull() == true if (!shouldShow) return diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetWalletNotificationsCarouselFactory.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetWalletNotificationsCarouselFactory.kt index 82610ab8c7..5b88f3fc17 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetWalletNotificationsCarouselFactory.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetWalletNotificationsCarouselFactory.kt @@ -15,7 +15,6 @@ import com.tangem.domain.yield.supply.promo.usecase.ShouldShowYieldBoostMainBann import com.tangem.domain.yield.supply.usecase.YieldSupplyGetShouldShowMainPromoUseCase import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents import com.tangem.feature.wallet.presentation.wallet.state.model.WalletNotificationUM -import com.tangem.features.yield.supply.api.YieldSupplyFeatureToggles import com.tangem.utils.extensions.addIf import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.toImmutableList @@ -38,7 +37,6 @@ internal class GetWalletNotificationsCarouselFactory @Inject constructor( private val notificationsRepository: NotificationsRepository, private val shouldShowYieldBoostMainBannerUseCase: ShouldShowYieldBoostMainBannerUseCase, private val yieldSupplyGetShouldShowMainPromoUseCase: YieldSupplyGetShouldShowMainPromoUseCase, - private val yieldSupplyFeatureToggles: YieldSupplyFeatureToggles, private val singleAccountStatusListSupplier: SingleAccountStatusListSupplier, ) { fun create(userWallet: UserWallet, clickIntents: WalletClickIntents): Flow> { @@ -86,7 +84,6 @@ internal class GetWalletNotificationsCarouselFactory @Inject constructor( clickIntents: WalletClickIntents, ) { if (!shouldShowLocal) return - if (!yieldSupplyFeatureToggles.isYieldPromoEnabled) return val shouldShow = shouldShowYieldBoostMainBannerUseCase(userWallet.walletId).getOrNull() == true if (!shouldShow) return add( diff --git a/features/wallet/impl/src/test/kotlin/com/tangem/feature/wallet/presentation/wallet/domain/GetWalletNotificationsCarouselFactoryTest.kt b/features/wallet/impl/src/test/kotlin/com/tangem/feature/wallet/presentation/wallet/domain/GetWalletNotificationsCarouselFactoryTest.kt index 5ce92507a5..37e3bfdbb8 100644 --- a/features/wallet/impl/src/test/kotlin/com/tangem/feature/wallet/presentation/wallet/domain/GetWalletNotificationsCarouselFactoryTest.kt +++ b/features/wallet/impl/src/test/kotlin/com/tangem/feature/wallet/presentation/wallet/domain/GetWalletNotificationsCarouselFactoryTest.kt @@ -18,7 +18,6 @@ import com.tangem.domain.yield.supply.promo.usecase.ShouldShowYieldBoostMainBann import com.tangem.domain.yield.supply.usecase.YieldSupplyGetShouldShowMainPromoUseCase import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents import com.tangem.feature.wallet.presentation.wallet.state.model.WalletNotificationUM -import com.tangem.features.yield.supply.api.YieldSupplyFeatureToggles import io.mockk.clearMocks import io.mockk.coEvery import io.mockk.every @@ -42,7 +41,6 @@ internal class GetWalletNotificationsCarouselFactoryTest { private val notificationsRepository: NotificationsRepository = mockk() private val shouldShowYieldBoostMainBannerUseCase: ShouldShowYieldBoostMainBannerUseCase = mockk() private val yieldSupplyGetShouldShowMainPromoUseCase: YieldSupplyGetShouldShowMainPromoUseCase = mockk() - private val yieldSupplyFeatureToggles: YieldSupplyFeatureToggles = mockk() private val singleAccountStatusListSupplier: SingleAccountStatusListSupplier = mockk(relaxed = true) private val clickIntents: WalletClickIntents = mockk(relaxed = true) private val userWallet: UserWallet.Hot = mockk(relaxed = true) @@ -53,7 +51,6 @@ internal class GetWalletNotificationsCarouselFactoryTest { notificationsRepository = notificationsRepository, shouldShowYieldBoostMainBannerUseCase = shouldShowYieldBoostMainBannerUseCase, yieldSupplyGetShouldShowMainPromoUseCase = yieldSupplyGetShouldShowMainPromoUseCase, - yieldSupplyFeatureToggles = yieldSupplyFeatureToggles, singleAccountStatusListSupplier = singleAccountStatusListSupplier, ) @@ -65,7 +62,6 @@ internal class GetWalletNotificationsCarouselFactoryTest { notificationsRepository, shouldShowYieldBoostMainBannerUseCase, yieldSupplyGetShouldShowMainPromoUseCase, - yieldSupplyFeatureToggles, singleAccountStatusListSupplier, clickIntents, userWallet, @@ -77,7 +73,6 @@ internal class GetWalletNotificationsCarouselFactoryTest { every { isReadyToShowRateAppUseCase() } returns flowOf(false) every { getWalletsUseCase() } returns flowOf(emptyList()) every { yieldSupplyGetShouldShowMainPromoUseCase() } returns flowOf(true) - every { yieldSupplyFeatureToggles.isYieldPromoEnabled } returns true coEvery { shouldShowYieldBoostMainBannerUseCase(any()) } returns Either.Right(true) // Balance is loaded by default, so banners gated on balance are not suppressed. every { @@ -89,7 +84,6 @@ internal class GetWalletNotificationsCarouselFactoryTest { @MethodSource("provideTestModels") fun `GIVEN gating conditions WHEN create THEN yield boost banner visibility matches`(model: Model) = runTest { // Arrange - every { yieldSupplyFeatureToggles.isYieldPromoEnabled } returns model.toggleEnabled every { yieldSupplyGetShouldShowMainPromoUseCase() } returns flowOf(model.shouldShowLocal) coEvery { shouldShowYieldBoostMainBannerUseCase(WALLET_ID) } returns model.mainBanner @@ -145,19 +139,16 @@ internal class GetWalletNotificationsCarouselFactoryTest { ) internal data class Model( - val toggleEnabled: Boolean, val shouldShowLocal: Boolean, val mainBanner: Either, val expectedShown: Boolean, ) private fun provideTestModels() = listOf( - Model(toggleEnabled = true, shouldShowLocal = true, mainBanner = Either.Right(true), expectedShown = true), - Model(toggleEnabled = false, shouldShowLocal = true, mainBanner = Either.Right(true), expectedShown = false), - Model(toggleEnabled = true, shouldShowLocal = false, mainBanner = Either.Right(true), expectedShown = false), - Model(toggleEnabled = true, shouldShowLocal = true, mainBanner = Either.Right(false), expectedShown = false), + Model(shouldShowLocal = true, mainBanner = Either.Right(true), expectedShown = true), + Model(shouldShowLocal = false, mainBanner = Either.Right(true), expectedShown = false), + Model(shouldShowLocal = true, mainBanner = Either.Right(false), expectedShown = false), Model( - toggleEnabled = true, shouldShowLocal = true, mainBanner = Either.Left(RuntimeException("boom")), expectedShown = false, diff --git a/features/yield-supply/api/src/main/java/com/tangem/features/yield/supply/api/YieldSupplyFeatureToggles.kt b/features/yield-supply/api/src/main/java/com/tangem/features/yield/supply/api/YieldSupplyFeatureToggles.kt deleted file mode 100644 index 6e45ae6093..0000000000 --- a/features/yield-supply/api/src/main/java/com/tangem/features/yield/supply/api/YieldSupplyFeatureToggles.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.tangem.features.yield.supply.api - -interface YieldSupplyFeatureToggles { - val isYieldPromoEnabled: Boolean -} \ No newline at end of file diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/DefaultYieldSupplyFeatureToggles.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/DefaultYieldSupplyFeatureToggles.kt deleted file mode 100644 index f277bfeff8..0000000000 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/DefaultYieldSupplyFeatureToggles.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.tangem.features.yield.supply.impl - -import com.tangem.core.configtoggle.FeatureToggles -import com.tangem.core.configtoggle.feature.FeatureTogglesManager -import com.tangem.features.yield.supply.api.YieldSupplyFeatureToggles -import javax.inject.Inject - -internal class DefaultYieldSupplyFeatureToggles @Inject constructor( - featureTogglesManager: FeatureTogglesManager, -) : YieldSupplyFeatureToggles { - - override val isYieldPromoEnabled: Boolean = featureTogglesManager.isFeatureEnabled( - toggle = FeatureToggles.AND_15154_YIELD_PROMO_ENABLED, - ) -} \ No newline at end of file diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/active/model/YieldSupplyActiveModel.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/active/model/YieldSupplyActiveModel.kt index 8751c8920d..c51653bd5b 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/active/model/YieldSupplyActiveModel.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/active/model/YieldSupplyActiveModel.kt @@ -33,7 +33,6 @@ import com.tangem.domain.yield.supply.models.YieldBoostStatus import com.tangem.domain.yield.supply.promo.usecase.GetYieldBoostStatusUseCase import com.tangem.domain.yield.supply.usecase.* import com.tangem.features.yield.supply.api.YieldSupplyActiveComponent -import com.tangem.features.yield.supply.api.YieldSupplyFeatureToggles import com.tangem.features.yield.supply.api.analytics.YieldSupplyAnalytics import com.tangem.features.yield.supply.impl.R import com.tangem.core.res.R as CoreResR @@ -72,7 +71,6 @@ internal class YieldSupplyActiveModel @Inject constructor( private val appRouter: AppRouter, private val yieldSupplyGetDustMinAmountUseCase: YieldSupplyGetDustMinAmountUseCase, private val getYieldBoostStatusUseCase: GetYieldBoostStatusUseCase, - private val yieldSupplyFeatureToggles: YieldSupplyFeatureToggles, private val boostStoryPreloader: YieldBoostStoryPreloader, ) : Model(), YieldSupplyStopEarningComponent.ModelCallback, YieldSupplyApproveComponent.ModelCallback { @@ -236,7 +234,6 @@ internal class YieldSupplyActiveModel @Inject constructor( } private fun loadBoostBlock() { - if (!yieldSupplyFeatureToggles.isYieldPromoEnabled) return modelScope.launch(dispatchers.io) { val token = cryptoCurrency as? CryptoCurrency.Token ?: return@launch val cached = getYieldBoostStatusUseCase(userWalletId).getOrNull() diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/di/YieldSupplyFeatureModule.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/di/YieldSupplyFeatureModule.kt deleted file mode 100644 index 0905d00fe8..0000000000 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/di/YieldSupplyFeatureModule.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.tangem.features.yield.supply.impl.di - -import com.tangem.core.configtoggle.feature.FeatureTogglesManager -import com.tangem.features.yield.supply.api.YieldSupplyFeatureToggles -import com.tangem.features.yield.supply.impl.DefaultYieldSupplyFeatureToggles -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 YieldSupplyFeatureModule { - - @Provides - @Singleton - fun provideYieldSupplyFeatureToggles(featureTogglesManager: FeatureTogglesManager): YieldSupplyFeatureToggles { - return DefaultYieldSupplyFeatureToggles(featureTogglesManager) - } -} \ No newline at end of file diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/entry/model/YieldSupplyEntryModel.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/entry/model/YieldSupplyEntryModel.kt index 3be94f3cc6..c0ad54b7ac 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/entry/model/YieldSupplyEntryModel.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/entry/model/YieldSupplyEntryModel.kt @@ -14,7 +14,6 @@ import com.tangem.domain.tokens.model.details.NavigationAction import com.tangem.domain.yield.supply.promo.usecase.IsYieldBoostPromoEnabledForTokenUseCase import com.tangem.domain.yield.supply.usecase.YieldSupplyEnterStatusUseCase import com.tangem.features.yield.supply.api.YieldSupplyEntryComponent -import com.tangem.features.yield.supply.api.YieldSupplyFeatureToggles import com.tangem.features.yield.supply.api.entry.YieldSupplyEntryRoute import com.tangem.utils.coroutines.CoroutineDispatcherProvider import kotlinx.coroutines.launch @@ -31,7 +30,6 @@ internal class YieldSupplyEntryModel @Inject constructor( private val yieldSupplyEnterStatusUseCase: YieldSupplyEnterStatusUseCase, private val singleAccountStatusListSupplier: SingleAccountStatusListSupplier, private val isYieldBoostPromoEnabledForTokenUseCase: IsYieldBoostPromoEnabledForTokenUseCase, - private val yieldSupplyFeatureToggles: YieldSupplyFeatureToggles, ) : Model() { private val params = paramsContainer.require() @@ -96,8 +94,7 @@ internal class YieldSupplyEntryModel @Inject constructor( return if (isActiveYield) { YieldSupplyEntryRoute.Active(cryptoCurrency = token) } else { - val isPromoEnabled = yieldSupplyFeatureToggles.isYieldPromoEnabled && - isYieldBoostPromoEnabledForTokenUseCase(userWalletId, token).getOrElse { false } + val isPromoEnabled = isYieldBoostPromoEnabledForTokenUseCase(userWalletId, token).getOrElse { false } YieldSupplyEntryRoute.Promo( cryptoCurrency = token, apy = params.apy, diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/model/YieldSupplyModel.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/model/YieldSupplyModel.kt index 55600bebc6..255e8d6b3d 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/model/YieldSupplyModel.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/model/YieldSupplyModel.kt @@ -31,7 +31,6 @@ import com.tangem.domain.yield.supply.promo.usecase.GetBoostedApyUseCase import com.tangem.domain.yield.supply.promo.usecase.IsYieldBoostPromoEnabledForTokenUseCase import com.tangem.domain.yield.supply.usecase.* import com.tangem.features.yield.supply.api.YieldSupplyComponent -import com.tangem.features.yield.supply.api.YieldSupplyFeatureToggles import com.tangem.features.yield.supply.api.analytics.YieldSupplyAnalytics import com.tangem.features.yield.supply.impl.R import com.tangem.features.yield.supply.impl.YieldBoostStoryPreloader @@ -68,7 +67,6 @@ internal class YieldSupplyModel @Inject constructor( private val yieldSupplyGetDustMinAmountUseCase: YieldSupplyGetDustMinAmountUseCase, private val isYieldBoostPromoEnabledForTokenUseCase: IsYieldBoostPromoEnabledForTokenUseCase, private val getBoostedApyUseCase: GetBoostedApyUseCase, - private val yieldSupplyFeatureToggles: YieldSupplyFeatureToggles, private val boostStoryPreloader: YieldBoostStoryPreloader, ) : Model(), YieldSupplyClickIntents { @@ -160,9 +158,8 @@ internal class YieldSupplyModel @Inject constructor( val cryptoCurrencyToken = cryptoCurrency as? CryptoCurrency.Token ?: return yieldSupplyGetTokenStatusUseCase(cryptoCurrencyToken) .onRight { tokenStatus -> - val isPromoEnabled = yieldSupplyFeatureToggles.isYieldPromoEnabled && - isYieldBoostPromoEnabledForTokenUseCase(params.userWalletId, cryptoCurrencyToken) - .getOrElse { false } + val isPromoEnabled = isYieldBoostPromoEnabledForTokenUseCase(params.userWalletId, cryptoCurrencyToken) + .getOrElse { false } val boostedApy = if (isPromoEnabled) getBoostedApyUseCase(tokenStatus.apy) else null uiStateLegacy.update( YieldSupplyTokenStatusSuccessTransformer( diff --git a/features/yield-supply/impl/src/test/java/com/tangem/features/yield/supply/impl/active/model/YieldSupplyActiveModelBoostBlockTest.kt b/features/yield-supply/impl/src/test/java/com/tangem/features/yield/supply/impl/active/model/YieldSupplyActiveModelBoostBlockTest.kt index 311aa39285..1d0281d929 100644 --- a/features/yield-supply/impl/src/test/java/com/tangem/features/yield/supply/impl/active/model/YieldSupplyActiveModelBoostBlockTest.kt +++ b/features/yield-supply/impl/src/test/java/com/tangem/features/yield/supply/impl/active/model/YieldSupplyActiveModelBoostBlockTest.kt @@ -23,7 +23,6 @@ import com.tangem.domain.yield.supply.usecase.YieldSupplyGetProtocolBalanceUseCa import com.tangem.domain.yield.supply.usecase.YieldSupplyGetTokenStatusUseCase import com.tangem.domain.yield.supply.usecase.YieldSupplyMinAmountUseCase import com.tangem.features.yield.supply.api.YieldSupplyActiveComponent -import com.tangem.features.yield.supply.api.YieldSupplyFeatureToggles import com.tangem.features.yield.supply.impl.YieldBoostStoryPreloader import com.tangem.utils.coroutines.TestingCoroutineDispatcherProvider import io.mockk.coEvery @@ -54,7 +53,6 @@ class YieldSupplyActiveModelBoostBlockTest { private val appRouter: AppRouter = mockk(relaxed = true) private val yieldSupplyGetDustMinAmountUseCase: YieldSupplyGetDustMinAmountUseCase = mockk(relaxed = true) private val getYieldBoostStatusUseCase: GetYieldBoostStatusUseCase = mockk(relaxed = true) - private val yieldSupplyFeatureToggles: YieldSupplyFeatureToggles = mockk(relaxed = true) private val boostStoryPreloader: YieldBoostStoryPreloader = mockk(relaxed = true) private val analyticsHandler: AnalyticsEventHandler = mockk(relaxed = true) @@ -83,7 +81,6 @@ class YieldSupplyActiveModelBoostBlockTest { @BeforeEach fun setUp() { - every { yieldSupplyFeatureToggles.isYieldPromoEnabled } returns true every { getUserWalletUseCase.invoke(userWalletId) } returns userWallet.right() every { singleAccountStatusListSupplier.invoke(userWalletId) } returns emptyFlow() coEvery { getSelectedAppCurrencyUseCase.invokeSync() } returns AppCurrency.Default.right() @@ -108,7 +105,6 @@ class YieldSupplyActiveModelBoostBlockTest { appRouter = appRouter, yieldSupplyGetDustMinAmountUseCase = yieldSupplyGetDustMinAmountUseCase, getYieldBoostStatusUseCase = getYieldBoostStatusUseCase, - yieldSupplyFeatureToggles = yieldSupplyFeatureToggles, boostStoryPreloader = boostStoryPreloader, ) @@ -147,16 +143,6 @@ class YieldSupplyActiveModelBoostBlockTest { coVerify(exactly = 1) { getYieldBoostStatusUseCase(userWalletId, true) } } - @Test - fun `GIVEN promo toggle disabled WHEN model created THEN does not query boost status`() = runTest { - every { yieldSupplyFeatureToggles.isYieldPromoEnabled } returns false - - val model = createModel() - - assertThat(model.uiState.value.boostText).isNull() - coVerify(exactly = 0) { getYieldBoostStatusUseCase(any(), any()) } - } - private companion object { const val CONTRACT_ADDRESS = "0xCONTRACT" const val NETWORK_ID = "ethereum" diff --git a/features/yield-supply/impl/src/test/java/com/tangem/features/yield/supply/impl/entry/model/YieldSupplyEntryModelTest.kt b/features/yield-supply/impl/src/test/java/com/tangem/features/yield/supply/impl/entry/model/YieldSupplyEntryModelTest.kt index 560732b75f..7579628c07 100644 --- a/features/yield-supply/impl/src/test/java/com/tangem/features/yield/supply/impl/entry/model/YieldSupplyEntryModelTest.kt +++ b/features/yield-supply/impl/src/test/java/com/tangem/features/yield/supply/impl/entry/model/YieldSupplyEntryModelTest.kt @@ -23,7 +23,6 @@ import com.tangem.domain.yield.supply.models.YieldSupplyPendingStatus import com.tangem.domain.yield.supply.promo.usecase.IsYieldBoostPromoEnabledForTokenUseCase import com.tangem.domain.yield.supply.usecase.YieldSupplyEnterStatusUseCase import com.tangem.features.yield.supply.api.YieldSupplyEntryComponent -import com.tangem.features.yield.supply.api.YieldSupplyFeatureToggles import com.tangem.features.yield.supply.api.entry.YieldSupplyEntryRoute import com.tangem.utils.coroutines.TestingCoroutineDispatcherProvider import io.mockk.clearMocks @@ -48,7 +47,6 @@ internal class YieldSupplyEntryModelTest { private val enterStatusUseCase: YieldSupplyEnterStatusUseCase = mockk() private val accountStatusListSupplier: SingleAccountStatusListSupplier = mockk() private val isPromoEnabledUseCase: IsYieldBoostPromoEnabledForTokenUseCase = mockk() - private val yieldSupplyFeatureToggles: YieldSupplyFeatureToggles = mockk() private val accountStatusList: AccountStatusList = mockk() @@ -56,11 +54,10 @@ internal class YieldSupplyEntryModelTest { fun setUp() { clearMocks( router, enterStatusUseCase, accountStatusListSupplier, - isPromoEnabledUseCase, yieldSupplyFeatureToggles, + isPromoEnabledUseCase, ) mockkObject(CryptoCurrencyStatusOperations) coEvery { accountStatusListSupplier.getSyncOrNull(USER_WALLET_ID) } returns accountStatusList - every { yieldSupplyFeatureToggles.isYieldPromoEnabled } returns true } @AfterEach @@ -176,21 +173,6 @@ internal class YieldSupplyEntryModelTest { assertThat(route.cryptoCurrency).isEqualTo(token()) } - @Test - fun `GIVEN promo toggle disabled WHEN created THEN Promo route with promo disabled`() = runTest { - // Arrange - every { yieldSupplyFeatureToggles.isYieldPromoEnabled } returns false - stubStatusLookup(status(isActive = false).some()) - coEvery { enterStatusUseCase(USER_WALLET_ID, any()) } returns null.right() - - // Act - createModel(currency = token()) - - // Assert - val route = captureReplacedRoute() - assertThat((route as YieldSupplyEntryRoute.Promo).isPromoEnabled).isFalse() - } - @Test fun `GIVEN promo use case returns false WHEN created THEN Promo route with promo disabled`() = runTest { // Arrange @@ -228,7 +210,6 @@ internal class YieldSupplyEntryModelTest { yieldSupplyEnterStatusUseCase = enterStatusUseCase, singleAccountStatusListSupplier = accountStatusListSupplier, isYieldBoostPromoEnabledForTokenUseCase = isPromoEnabledUseCase, - yieldSupplyFeatureToggles = yieldSupplyFeatureToggles, ) private fun pendingEnter(): YieldSupplyPendingStatus = YieldSupplyPendingStatus.Enter(txIds = listOf("0xTx")) diff --git a/features/yield-supply/impl/src/test/java/com/tangem/features/yield/supply/impl/main/model/YieldSupplyModelTest.kt b/features/yield-supply/impl/src/test/java/com/tangem/features/yield/supply/impl/main/model/YieldSupplyModelTest.kt index 359d3fd1aa..afacc7f2e6 100644 --- a/features/yield-supply/impl/src/test/java/com/tangem/features/yield/supply/impl/main/model/YieldSupplyModelTest.kt +++ b/features/yield-supply/impl/src/test/java/com/tangem/features/yield/supply/impl/main/model/YieldSupplyModelTest.kt @@ -43,7 +43,6 @@ import com.tangem.domain.yield.supply.usecase.YieldSupplyGetTokenStatusUseCase import com.tangem.domain.yield.supply.usecase.YieldSupplyIsAvailableUseCase import com.tangem.domain.yield.supply.usecase.YieldSupplyMinAmountUseCase import com.tangem.features.yield.supply.api.YieldSupplyComponent -import com.tangem.features.yield.supply.api.YieldSupplyFeatureToggles import com.tangem.features.yield.supply.api.analytics.YieldSupplyAnalytics import com.tangem.features.yield.supply.impl.YieldBoostStoryPreloader import com.tangem.features.yield.supply.impl.main.entity.YieldSupplyUM @@ -87,7 +86,6 @@ internal class YieldSupplyModelTest { private val getDustMinAmountUseCase: YieldSupplyGetDustMinAmountUseCase = mockk() private val isBoostPromoEnabledUseCase: IsYieldBoostPromoEnabledForTokenUseCase = mockk() private val getBoostedApyUseCase = GetBoostedApyUseCase() - private val featureToggles: YieldSupplyFeatureToggles = mockk() private val boostStoryPreloader: YieldBoostStoryPreloader = mockk(relaxed = true) private val userWalletId = UserWalletId("abcdef012345") @@ -108,7 +106,6 @@ internal class YieldSupplyModelTest { coEvery { singleNetworkStatusFetcher(any()) } returns Unit.right() coEvery { getTokenStatusUseCase(any()) } returns marketToken(isActive = true).right() coEvery { isBoostPromoEnabledUseCase(any(), any()) } returns false.right() - every { featureToggles.isYieldPromoEnabled } returns false coEvery { activateUseCase(any(), any(), any()) } returns true.right() coEvery { deactivateUseCase(any(), any()) } returns true.right() coEvery { minAmountUseCase(any(), any()) } returns BigDecimal("5").right() @@ -172,7 +169,6 @@ internal class YieldSupplyModelTest { @Test fun `GIVEN promo enabled for token WHEN status emitted THEN boosted available promo`() = runTest { // Arrange - every { featureToggles.isYieldPromoEnabled } returns true coEvery { isBoostPromoEnabledUseCase(any(), any()) } returns true.right() // Act @@ -583,7 +579,6 @@ internal class YieldSupplyModelTest { yieldSupplyGetDustMinAmountUseCase = getDustMinAmountUseCase, isYieldBoostPromoEnabledForTokenUseCase = isBoostPromoEnabledUseCase, getBoostedApyUseCase = getBoostedApyUseCase, - yieldSupplyFeatureToggles = featureToggles, boostStoryPreloader = boostStoryPreloader, )