Updated on 2026-08-14

This commit is contained in:
Tangem 2025-10-16 16:58:38 +05:00
parent 709eb125b3
commit 8dec1af7aa
21 changed files with 124 additions and 12 deletions

View file

@ -9,6 +9,7 @@ internal sealed class YieldSupplyUM {
data object Initial : YieldSupplyUM()
data class Available(
val apy: String,
val title: TextReference,
val onClick: () -> Unit,
) : YieldSupplyUM()
@ -18,6 +19,7 @@ internal sealed class YieldSupplyUM {
data object Unavailable : YieldSupplyUM()
data class Content(
val apy: String,
val title: TextReference,
val subtitle: TextReference,
val rewardsApy: TextReference,

View file

@ -144,10 +144,17 @@ internal class YieldSupplyModel @Inject constructor(
}
override fun onStartEarningClick() {
val yieldSupplyUM = uiState.value
val apy = when (yieldSupplyUM) {
is YieldSupplyUM.Available -> yieldSupplyUM.apy
is YieldSupplyUM.Content -> yieldSupplyUM.apy
else -> ""
}
appRouter.push(
YieldSupplyPromo(
userWalletId = params.userWalletId,
cryptoCurrency = params.cryptoCurrency,
apy = apy,
),
)
}
@ -218,6 +225,7 @@ internal class YieldSupplyModel @Inject constructor(
),
onClick = ::onActiveClick,
isAllowedToSpend = yieldSupplyStatus.isAllowedToSpend,
apy = tokenStatus.apy.toString(),
)
}
}.onLeft {

View file

@ -21,6 +21,7 @@ internal class YieldSupplyTokenStatusSuccessTransformer(
formatArgs = wrappedList(tokenStatus.apy),
),
onClick = onStartEarningClick,
apy = tokenStatus.apy.toString(),
)
}
}

View file

@ -308,6 +308,7 @@ private class PreviewProvider : PreviewParameterProvider<YieldSupplyUM> {
R.string.yield_module_token_details_earn_notification_title,
wrappedList("5.1"),
),
apy = "5.1",
onClick = {},
),
YieldSupplyUM.Content(
@ -315,6 +316,7 @@ private class PreviewProvider : PreviewParameterProvider<YieldSupplyUM> {
subtitle = stringReference("Interest accrues automatically"),
rewardsApy = stringReference("5.1 % APY"),
onClick = {},
apy = "5.1",
isAllowedToSpend = false,
),
YieldSupplyUM.Content(
@ -322,6 +324,7 @@ private class PreviewProvider : PreviewParameterProvider<YieldSupplyUM> {
subtitle = stringReference("Interest accrues automatically"),
rewardsApy = stringReference("5.1 % APY"),
onClick = {},
apy = "5.1",
isAllowedToSpend = true,
),
YieldSupplyUM.Loading,

View file

@ -6,4 +6,5 @@ data class YieldSupplyPromoUM(
val tosLink: String,
val policyLink: String,
val title: TextReference,
val subtitle: TextReference,
)

View file

@ -33,7 +33,11 @@ internal class YieldSupplyPromoModel @Inject constructor(
val uiState: YieldSupplyPromoUM = YieldSupplyPromoUM(
tosLink = "https://tangem.com/terms-of-service/", // TODO replace with real link
policyLink = "https://tangem.com/privacy-policy/", // TODO replace with real link
title = resourceReference(R.string.yield_module_promo_screen_title, wrappedList("5.3")),
title = resourceReference(R.string.yield_module_promo_screen_title),
subtitle = resourceReference(
R.string.yield_module_promo_screen_variable_rate_info,
wrappedList(params.apy),
),
)
init {

View file

@ -73,7 +73,7 @@ internal fun YieldSupplyPromoContent(
SpacerH8()
Label(
state = LabelUM(
text = resourceReference(R.string.yield_module_promo_screen_variable_rate_info),
text = yieldSupplyPromoUM.subtitle,
style = LabelStyle.REGULAR,
icon = R.drawable.ic_information_24,
onIconClick = clickIntents::onApyInfoClick,
@ -223,7 +223,8 @@ private fun YieldSupplyPromoContent_Preview() {
yieldSupplyPromoUM = YieldSupplyPromoUM(
tosLink = "https://tangem.com/terms-of-service/",
policyLink = "https://tangem.com/privacy-policy/",
title = resourceReference(R.string.yield_module_promo_screen_title, wrappedList("5.3")),
title = resourceReference(R.string.yield_module_promo_screen_title),
subtitle = resourceReference(R.string.yield_module_promo_screen_variable_rate_info, wrappedList("5.3")),
),
clickIntents = object : YieldSupplyPromoClickIntents {
override fun onBackClick() {}