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

@ -7,6 +7,7 @@ import com.tangem.domain.models.currency.CryptoCurrency
import com.tangem.domain.tokens.model.analytics.TokenSwapPromoAnalyticsEvent
import com.tangem.feature.tokendetails.presentation.tokendetails.state.TokenDetailsState
import com.tangem.feature.tokendetails.presentation.tokendetails.state.components.TokenDetailsNotification
import com.tangem.features.yield.supply.api.analytics.YieldSupplyAnalytics
internal class TokenDetailsNotificationsAnalyticsSender(
private val cryptoCurrency: CryptoCurrency,
@ -44,6 +45,10 @@ internal class TokenDetailsNotificationsAnalyticsSender(
is TokenDetailsNotification.KaspaIncompleteTransactionWarning -> TokenDetailsAnalyticsEvent.Notice.Reveal(
currency = cryptoCurrency,
)
is TokenDetailsNotification.YieldSupplyNotTransferedToAave -> YieldSupplyAnalytics.NoticeNotEnoughMinAmount(
token = cryptoCurrency.symbol,
blockchain = cryptoCurrency.network.name,
)
is TokenDetailsNotification.NetworksUnreachable,
is TokenDetailsNotification.ExistentialDeposit,
is TokenDetailsNotification.NetworksNoAccount,

View file

@ -6,6 +6,7 @@ import com.tangem.core.ui.components.notifications.NotificationConfig
import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.extensions.networkIconResId
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.extensions.stringReference
import com.tangem.core.ui.extensions.wrappedList
import com.tangem.domain.models.currency.CryptoCurrency
import com.tangem.domain.models.wallet.UserWallet
@ -257,4 +258,12 @@ internal sealed class TokenDetailsNotification(val config: NotificationConfig) {
iconResId = R.drawable.ic_error_sync_24,
),
)
data class YieldSupplyNotTransferedToAave(val tokenName: String, val amount: String) : Warning(
title = resourceReference(
id = R.string.yield_module_amount_not_transfered_to_aave_title,
wrappedList(amount, tokenName),
),
subtitle = stringReference(""),
)
}

View file

@ -24,6 +24,7 @@ import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList
import timber.log.Timber
import java.math.BigDecimal
import kotlin.String
internal class TokenDetailsNotificationConverter(
private val userWalletId: UserWalletId,
@ -155,6 +156,10 @@ internal class TokenDetailsNotificationConverter(
)
is CryptoCurrencyWarning.MigrationMaticToPol -> MigrationMaticToPol
is CryptoCurrencyWarning.UsedOutdatedDataWarning -> UsedOutdatedData
is CryptoCurrencyWarning.YieldSupplyNotDepositedAmount -> YieldSupplyNotTransferedToAave(
tokenName = warning.currencySymbol,
amount = warning.amount.format { crypto(symbol = "", decimals = warning.currency.decimals) },
)
}
}

View file

@ -10,6 +10,7 @@ interface YieldSupplyPromoComponent : ComposableContentComponent {
data class Params(
val userWalletId: UserWalletId,
val currency: CryptoCurrency,
val apy: String,
)
interface Factory : ComponentFactory<Params, YieldSupplyPromoComponent>

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() {}