Updated on 2026-08-14

This commit is contained in:
Tangem 2025-11-10 16:27:16 +05:00
parent 540d1382f1
commit c54ca6134c
6 changed files with 37 additions and 18 deletions

View file

@ -26,6 +26,7 @@ internal sealed class YieldSupplyUM {
val rewardsApy: TextReference,
val onClick: () -> Unit,
val showWarningIcon: Boolean,
val showInfoIcon: Boolean,
) : YieldSupplyUM()
@Immutable

View file

@ -253,8 +253,8 @@ internal class YieldSupplyModel @Inject constructor(
private fun loadActiveState(cryptoCurrencyStatus: CryptoCurrencyStatus, yieldSupplyStatus: YieldSupplyStatus) {
val cryptoCurrencyToken = cryptoCurrency as? CryptoCurrency.Token ?: return
val showWarningIcon = !yieldSupplyStatus.isAllowedToSpend ||
cryptoCurrencyStatus.yieldSupplyNotAllAmountSupplied()
val showWarningIcon = !yieldSupplyStatus.isAllowedToSpend
val showInfoIcon = cryptoCurrencyStatus.yieldSupplyNotAllAmountSupplied()
if (!yieldSupplyStatus.isAllowedToSpend) {
analyticsEventsHandler.send(
YieldSupplyAnalytics.NoticeApproveNeeded(
@ -282,6 +282,7 @@ internal class YieldSupplyModel @Inject constructor(
),
onClick = ::onActiveClick,
showWarningIcon = showWarningIcon,
showInfoIcon = showInfoIcon,
apy = tokenStatus.apy.toString(),
)
}
@ -298,6 +299,7 @@ internal class YieldSupplyModel @Inject constructor(
rewardsApy = TextReference.EMPTY,
onClick = ::onActiveClick,
showWarningIcon = showWarningIcon,
showInfoIcon = showInfoIcon,
apy = "",
)
}

View file

@ -149,12 +149,21 @@ private fun SupplyContent(supplyUM: YieldSupplyUM.Content, modifier: Modifier =
)
}
SpacerW8()
AnimatedVisibility(supplyUM.showWarningIcon) {
Icon(
imageVector = ImageVector.vectorResource(R.drawable.ic_alert_triangle_20),
contentDescription = null,
tint = TangemTheme.colors.icon.attention,
)
AnimatedContent(
targetState = supplyUM,
) { currentState ->
when {
currentState.showWarningIcon -> Icon(
imageVector = ImageVector.vectorResource(R.drawable.ic_alert_triangle_20),
contentDescription = null,
tint = TangemTheme.colors.icon.attention,
)
currentState.showInfoIcon -> Icon(
imageVector = ImageVector.vectorResource(R.drawable.ic_alert_circle_red_20),
contentDescription = null,
tint = TangemTheme.colors.icon.accent,
)
}
}
Icon(
imageVector = ImageVector.vectorResource(R.drawable.ic_chevron_right_24),
@ -355,6 +364,7 @@ private class PreviewProvider : PreviewParameterProvider<YieldSupplyUM> {
onClick = {},
apy = "5.1",
showWarningIcon = false,
showInfoIcon = true,
),
YieldSupplyUM.Content(
title = stringReference("Aave lending is active "),
@ -363,6 +373,7 @@ private class PreviewProvider : PreviewParameterProvider<YieldSupplyUM> {
onClick = {},
apy = "5.1",
showWarningIcon = true,
showInfoIcon = false,
),
YieldSupplyUM.Loading,
YieldSupplyUM.Processing.Enter,

View file

@ -195,7 +195,7 @@ internal class YieldSupplyActiveModel @Inject constructor(
blockchain = cryptoCurrency.network.name,
),
)
NotificationUM.Warning.YieldSupplyNotAllAmountSupplied(
NotificationUM.Info.YieldSupplyNotAllAmountSupplied(
formattedAmount = formattedAmount,
symbol = cryptoCurrency.symbol,
)

View file

@ -74,6 +74,11 @@ internal fun YieldSupplyActiveContent(
Notification(
config = notificationUM.config,
containerColor = TangemTheme.colors.background.action,
iconTint = if (notificationUM is NotificationUM.Info) {
TangemTheme.colors.icon.accent
} else {
null
},
)
}
}