diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/active/model/BoostBlockState.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/active/model/BoostBlockState.kt index a2f2a2ffb9..8239057c3d 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/active/model/BoostBlockState.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/active/model/BoostBlockState.kt @@ -23,5 +23,10 @@ internal fun resolveBoostBlockState(qualificationEndDate: Instant?, now: Instant qualificationEndDate == null -> BoostBlockState.Hidden now >= qualificationEndDate + AWAITING_PAYOUT_WINDOW -> BoostBlockState.Hidden now >= qualificationEndDate -> BoostBlockState.AwaitingPayout - else -> BoostBlockState.DaysLeft(days = (qualificationEndDate - now).inWholeDays.toInt()) + else -> { + val remaining = qualificationEndDate - now + val fullDays = remaining.inWholeDays + val daysLeft = if (remaining > fullDays.days) fullDays + 1 else fullDays + BoostBlockState.DaysLeft(days = daysLeft.toInt()) + } } \ 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 ebb0ceb070..8751c8920d 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 @@ -11,7 +11,6 @@ import com.tangem.core.decompose.di.ModelScoped import com.tangem.core.decompose.model.Model import com.tangem.core.decompose.model.ParamsContainer import com.tangem.core.navigation.url.UrlOpener -import com.tangem.core.ui.DesignFeatureToggles import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.combinedReference import com.tangem.core.ui.extensions.pluralReference @@ -74,7 +73,6 @@ internal class YieldSupplyActiveModel @Inject constructor( private val yieldSupplyGetDustMinAmountUseCase: YieldSupplyGetDustMinAmountUseCase, private val getYieldBoostStatusUseCase: GetYieldBoostStatusUseCase, private val yieldSupplyFeatureToggles: YieldSupplyFeatureToggles, - private val designFeatureToggles: DesignFeatureToggles, private val boostStoryPreloader: YieldBoostStoryPreloader, ) : Model(), YieldSupplyStopEarningComponent.ModelCallback, YieldSupplyApproveComponent.ModelCallback { @@ -239,7 +237,6 @@ internal class YieldSupplyActiveModel @Inject constructor( private fun loadBoostBlock() { if (!yieldSupplyFeatureToggles.isYieldPromoEnabled) return - if (designFeatureToggles.isRedesignEnabled) 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/entry/model/YieldSupplyEntryModel.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/entry/model/YieldSupplyEntryModel.kt index f76c3881c8..3be94f3cc6 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 @@ -6,7 +6,6 @@ import com.tangem.core.decompose.di.ModelScoped import com.tangem.core.decompose.model.Model import com.tangem.core.decompose.model.ParamsContainer import com.tangem.core.decompose.navigation.Router -import com.tangem.core.ui.DesignFeatureToggles import com.tangem.domain.account.status.supplier.SingleAccountStatusListSupplier import com.tangem.domain.account.status.utils.CryptoCurrencyStatusOperations.getCryptoCurrencyStatus import com.tangem.domain.models.currency.CryptoCurrency @@ -33,7 +32,6 @@ internal class YieldSupplyEntryModel @Inject constructor( private val singleAccountStatusListSupplier: SingleAccountStatusListSupplier, private val isYieldBoostPromoEnabledForTokenUseCase: IsYieldBoostPromoEnabledForTokenUseCase, private val yieldSupplyFeatureToggles: YieldSupplyFeatureToggles, - private val designFeatureToggles: DesignFeatureToggles, ) : Model() { private val params = paramsContainer.require() @@ -99,7 +97,6 @@ internal class YieldSupplyEntryModel @Inject constructor( YieldSupplyEntryRoute.Active(cryptoCurrency = token) } else { val isPromoEnabled = yieldSupplyFeatureToggles.isYieldPromoEnabled && - !designFeatureToggles.isRedesignEnabled && isYieldBoostPromoEnabledForTokenUseCase(userWalletId, token).getOrElse { false } YieldSupplyEntryRoute.Promo( cryptoCurrency = token, diff --git a/features/yield-supply/impl/src/test/java/com/tangem/features/yield/supply/impl/active/model/BoostBlockStateTest.kt b/features/yield-supply/impl/src/test/java/com/tangem/features/yield/supply/impl/active/model/BoostBlockStateTest.kt index 63580acb2c..95cf198764 100644 --- a/features/yield-supply/impl/src/test/java/com/tangem/features/yield/supply/impl/active/model/BoostBlockStateTest.kt +++ b/features/yield-supply/impl/src/test/java/com/tangem/features/yield/supply/impl/active/model/BoostBlockStateTest.kt @@ -26,13 +26,34 @@ internal class BoostBlockStateTest { } @Test - fun `GIVEN qualificationEndDate less than a day away WHEN resolve THEN DaysLeft zero`() { + fun `GIVEN qualificationEndDate less than a day away WHEN resolve THEN DaysLeft one`() { val result = resolveBoostBlockState( qualificationEndDate = Instant.parse("2026-05-28T18:00:00Z"), now = now, ) - assertThat(result).isEqualTo(BoostBlockState.DaysLeft(days = 0)) + assertThat(result).isEqualTo(BoostBlockState.DaysLeft(days = 1)) + } + + @Test + fun `GIVEN qualificationEndDate just over a day away WHEN resolve THEN DaysLeft rounds up`() { + val result = resolveBoostBlockState( + // 1d 1h away — rounds up to 2 + qualificationEndDate = Instant.parse("2026-05-29T01:00:00Z"), + now = now, + ) + + assertThat(result).isEqualTo(BoostBlockState.DaysLeft(days = 2)) + } + + @Test + fun `GIVEN qualificationEndDate exactly whole days away WHEN resolve THEN DaysLeft exact`() { + val result = resolveBoostBlockState( + qualificationEndDate = Instant.parse("2026-05-30T00:00:00Z"), + now = now, + ) + + assertThat(result).isEqualTo(BoostBlockState.DaysLeft(days = 2)) } @Test 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 9f1f466d7d..311aa39285 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 @@ -5,7 +5,6 @@ import com.google.common.truth.Truth.assertThat import com.tangem.core.analytics.api.AnalyticsEventHandler import com.tangem.core.decompose.model.MutableParamsContainer import com.tangem.core.navigation.url.UrlOpener -import com.tangem.core.ui.DesignFeatureToggles import com.tangem.common.routing.AppRouter import com.tangem.domain.account.status.supplier.SingleAccountStatusListSupplier import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase @@ -56,7 +55,6 @@ class YieldSupplyActiveModelBoostBlockTest { private val yieldSupplyGetDustMinAmountUseCase: YieldSupplyGetDustMinAmountUseCase = mockk(relaxed = true) private val getYieldBoostStatusUseCase: GetYieldBoostStatusUseCase = mockk(relaxed = true) private val yieldSupplyFeatureToggles: YieldSupplyFeatureToggles = mockk(relaxed = true) - private val designFeatureToggles: DesignFeatureToggles = mockk(relaxed = true) private val boostStoryPreloader: YieldBoostStoryPreloader = mockk(relaxed = true) private val analyticsHandler: AnalyticsEventHandler = mockk(relaxed = true) @@ -86,7 +84,6 @@ class YieldSupplyActiveModelBoostBlockTest { @BeforeEach fun setUp() { every { yieldSupplyFeatureToggles.isYieldPromoEnabled } returns true - every { designFeatureToggles.isRedesignEnabled } returns false every { getUserWalletUseCase.invoke(userWalletId) } returns userWallet.right() every { singleAccountStatusListSupplier.invoke(userWalletId) } returns emptyFlow() coEvery { getSelectedAppCurrencyUseCase.invokeSync() } returns AppCurrency.Default.right() @@ -112,7 +109,6 @@ class YieldSupplyActiveModelBoostBlockTest { yieldSupplyGetDustMinAmountUseCase = yieldSupplyGetDustMinAmountUseCase, getYieldBoostStatusUseCase = getYieldBoostStatusUseCase, yieldSupplyFeatureToggles = yieldSupplyFeatureToggles, - designFeatureToggles = designFeatureToggles, boostStoryPreloader = boostStoryPreloader, )