From c3c4eaf1f671c70c15c3c02588f8a75d1fbdd777 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 18 Dec 2025 10:02:42 +0400 Subject: [PATCH] Updated on 2026-08-14 --- .../api/analytics/YieldSupplyAnalytics.kt | 11 +++++++ .../model/YieldSupplyNotificationsModel.kt | 29 ++++++++++++++----- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/features/yield-supply/api/src/main/java/com/tangem/features/yield/supply/api/analytics/YieldSupplyAnalytics.kt b/features/yield-supply/api/src/main/java/com/tangem/features/yield/supply/api/analytics/YieldSupplyAnalytics.kt index 37b00d61b2..4b7b61f898 100644 --- a/features/yield-supply/api/src/main/java/com/tangem/features/yield/supply/api/analytics/YieldSupplyAnalytics.kt +++ b/features/yield-supply/api/src/main/java/com/tangem/features/yield/supply/api/analytics/YieldSupplyAnalytics.kt @@ -204,6 +204,17 @@ sealed class YieldSupplyAnalytics( ), ) + data class NoticeHighFee( + val token: String, + val blockchain: String, + ) : YieldSupplyAnalytics( + event = "Notice - High Network Fee", + params = mapOf( + TOKEN_PARAM to token, + BLOCKCHAIN to blockchain, + ), + ) + enum class Action(val value: String) { Start("Start"), Approve("Approve"), diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/notifications/model/YieldSupplyNotificationsModel.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/notifications/model/YieldSupplyNotificationsModel.kt index 58e72d7f9a..fc8a944729 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/notifications/model/YieldSupplyNotificationsModel.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/notifications/model/YieldSupplyNotificationsModel.kt @@ -80,14 +80,7 @@ internal class YieldSupplyNotificationsModel @Inject constructor( } } - if (notifications.any { it is NotificationUM.Error.TokenExceedsBalance }) { - analyticsEventHandler.send( - YieldSupplyAnalytics.NoticeNotEnoughFee( - token = cryptoCurrencyStatus.currency.symbol, - blockchain = cryptoCurrencyStatus.currency.network.name, - ), - ) - } + sendAnalytics(notifications, cryptoCurrencyStatus.currency) uiState.update { notifications.toPersistentList() } @@ -97,6 +90,26 @@ internal class YieldSupplyNotificationsModel @Inject constructor( }.launchIn(modelScope) } + private fun sendAnalytics(notifications: List, currency: CryptoCurrency) { + if (notifications.any { it is NotificationUM.Error.TokenExceedsBalance }) { + analyticsEventHandler.send( + YieldSupplyAnalytics.NoticeNotEnoughFee( + token = currency.symbol, + blockchain = currency.network.name, + ), + ) + } + + if (notifications.any { it is NotificationUM.Info.YieldSupplyHighNetworkFee }) { + analyticsEventHandler.send( + YieldSupplyAnalytics.NoticeHighFee( + token = currency.symbol, + blockchain = currency.network.name, + ), + ) + } + } + private fun openTokenDetails(cryptoCurrency: CryptoCurrency) { appRouter.push( AppRoute.CurrencyDetails(