diff --git a/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationUM.kt b/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationUM.kt index 662a404f90..7425a7aa0f 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationUM.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationUM.kt @@ -275,14 +275,6 @@ sealed class NotificationUM(val config: NotificationConfig) { title = resourceReference(id = R.string.yield_module_balance_info_sheet_title, wrappedList(tokenName)), subtitle = resourceReference(id = R.string.yield_module_balance_info_sheet_subtitle), ) - - data class YieldSupplyNotAllAmountSupplied(val formattedAmount: String, val symbol: String) : Warning( - title = resourceReference( - id = R.string.yield_module_amount_not_transfered_to_aave_title, - formatArgs = wrappedList(formattedAmount, symbol), - ), - subtitle = TextReference.EMPTY, - ) } open class Info( @@ -301,7 +293,15 @@ sealed class NotificationUM(val config: NotificationConfig) { onCloseClick = onCloseClick, iconTint = iconTint, ), - ) + ) { + data class YieldSupplyNotAllAmountSupplied(val formattedAmount: String, val symbol: String) : Info( + title = resourceReference( + id = R.string.yield_module_amount_not_transfered_to_aave_title, + formatArgs = wrappedList(formattedAmount, symbol), + ), + subtitle = TextReference.EMPTY, + ) + } sealed interface Cardano { diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/entity/YieldSupplyUM.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/entity/YieldSupplyUM.kt index fab5e5aa21..a3ec2d930e 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/entity/YieldSupplyUM.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/entity/YieldSupplyUM.kt @@ -26,6 +26,7 @@ internal sealed class YieldSupplyUM { val rewardsApy: TextReference, val onClick: () -> Unit, val showWarningIcon: Boolean, + val showInfoIcon: Boolean, ) : YieldSupplyUM() @Immutable 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 2360b55d2d..4ae0cf1e53 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 @@ -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 = "", ) } diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/ui/YieldSupplyBlockContent.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/ui/YieldSupplyBlockContent.kt index 1dc3b822c5..d4414727ef 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/ui/YieldSupplyBlockContent.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/main/ui/YieldSupplyBlockContent.kt @@ -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 { onClick = {}, apy = "5.1", showWarningIcon = false, + showInfoIcon = true, ), YieldSupplyUM.Content( title = stringReference("Aave lending is active "), @@ -363,6 +373,7 @@ private class PreviewProvider : PreviewParameterProvider { onClick = {}, apy = "5.1", showWarningIcon = true, + showInfoIcon = false, ), YieldSupplyUM.Loading, YieldSupplyUM.Processing.Enter, diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/YieldSupplyActiveModel.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/YieldSupplyActiveModel.kt index 070ec52cb7..414cd7a29d 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/YieldSupplyActiveModel.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/YieldSupplyActiveModel.kt @@ -195,7 +195,7 @@ internal class YieldSupplyActiveModel @Inject constructor( blockchain = cryptoCurrency.network.name, ), ) - NotificationUM.Warning.YieldSupplyNotAllAmountSupplied( + NotificationUM.Info.YieldSupplyNotAllAmountSupplied( formattedAmount = formattedAmount, symbol = cryptoCurrency.symbol, ) diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/ui/YieldSupplyActiveContent.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/ui/YieldSupplyActiveContent.kt index 689c77d719..f303d4ae1e 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/ui/YieldSupplyActiveContent.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/ui/YieldSupplyActiveContent.kt @@ -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 + }, ) } }