From 7dfff7c34f322fca888edfaf8880d9c1fa437cf9 Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 6 Oct 2025 08:48:29 +0200 Subject: [PATCH] Updated on 2026-08-14 --- core/res/src/main/res/values/strings.xml | 1 + .../domain/models/domain/ExchangeStatus.kt | 10 +++++----- .../components/ExchangeStatusNotification.kt | 7 +++++-- ...kenDetailsSwapTransactionsStateConverter.kt | 18 ++++++++++++------ .../ExpressStatusBottomSheetStateProvider.kt | 5 ++++- 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/core/res/src/main/res/values/strings.xml b/core/res/src/main/res/values/strings.xml index b9b65e3393..db57bd8a71 100644 --- a/core/res/src/main/res/values/strings.xml +++ b/core/res/src/main/res/values/strings.xml @@ -916,6 +916,7 @@ By balance Organize tokens Ungroup + %s support More info You can enable Notifications for Tangem in Settings. Enable Later diff --git a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/ExchangeStatus.kt b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/ExchangeStatus.kt index 15d4228d1b..69300406c2 100644 --- a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/ExchangeStatus.kt +++ b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/ExchangeStatus.kt @@ -32,11 +32,11 @@ data class ExchangeStatusModel( val averageDuration: Int? = null, ) { val hasLongTime: Boolean - get() = if (createdAt != null && averageDuration != null) { - DateTime.now().minusSeconds(averageDuration * 5) > createdAt - } else { - false - } + get() = createdAt?.isBefore(DateTime.now().minusMinutes(FIFTEEN_MINUTES)) ?: false + + private companion object { + const val FIFTEEN_MINUTES = 15 + } } @JsonClass(generateAdapter = false) diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/components/ExchangeStatusNotification.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/components/ExchangeStatusNotification.kt index 8817f3a7f7..c36b62c6e9 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/components/ExchangeStatusNotification.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/components/ExchangeStatusNotification.kt @@ -45,13 +45,16 @@ internal sealed interface ExchangeStatusNotification { ), ) - data class LongTimeExchange(val onGoToProviderClick: () -> Unit) : CommonNotification( + data class LongTimeExchange( + private val onGoToProviderClick: () -> Unit, + private val providerName: String, + ) : CommonNotification( config = NotificationConfig( title = resourceReference(R.string.express_exchange_notification_long_transaction_time_title), subtitle = resourceReference(R.string.express_exchange_notification_long_transaction_time_text), iconResId = R.drawable.ic_alert_triangle_20, buttonsState = NotificationConfig.ButtonsState.SecondaryButtonConfig( - text = resourceReference(R.string.common_go_to_provider), + text = resourceReference(R.string.provider_name_support, wrappedList(providerName)), onClick = onGoToProviderClick, ), ), diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsSwapTransactionsStateConverter.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsSwapTransactionsStateConverter.kt index 01835b8f16..42e28102ef 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsSwapTransactionsStateConverter.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsSwapTransactionsStateConverter.kt @@ -93,6 +93,7 @@ internal class TokenDetailsSwapTransactionsStateConverter( txUrl = statusModel?.txExternalUrl, refundToken = statusModel?.refundCurrency, hasLongTime = statusModel?.hasLongTime, + providerName = transaction.provider.name, ) val showProviderLink = getShowProviderLink(notification, transaction.status) result.add( @@ -130,6 +131,7 @@ internal class TokenDetailsSwapTransactionsStateConverter( txUrl = statusModel.txExternalUrl, refundToken = statusModel.refundCurrency, hasLongTime = statusModel.hasLongTime, + providerName = tx.provider.name, ) val showProviderLink = getShowProviderLink(notification, statusModel) return tx.copy( @@ -201,6 +203,7 @@ internal class TokenDetailsSwapTransactionsStateConverter( txUrl: String?, refundToken: CryptoCurrency?, hasLongTime: Boolean?, + providerName: String, ): ExchangeStatusNotification? { return when { status == ExchangeStatus.Failed || status == ExchangeStatus.TxFailed -> { @@ -233,12 +236,15 @@ internal class TokenDetailsSwapTransactionsStateConverter( } } status?.isTerminal == false && txUrl != null && hasLongTime == true -> { - ExchangeStatusNotification.LongTimeExchange { - analyticsEventsHandler.send( - event = TokenExchangeAnalyticsEvent.GoToProviderLongTime(cryptoCurrency.symbol), - ) - clickIntents.onGoToProviderClick(txUrl) - } + ExchangeStatusNotification.LongTimeExchange( + onGoToProviderClick = { + analyticsEventsHandler.send( + event = TokenExchangeAnalyticsEvent.GoToProviderLongTime(cryptoCurrency.symbol), + ) + clickIntents.onGoToProviderClick(txUrl) + }, + providerName = providerName, + ) } else -> null } diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/components/express/ExpressStatusBottomSheetStateProvider.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/components/express/ExpressStatusBottomSheetStateProvider.kt index fc4a214ee0..427406a32b 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/components/express/ExpressStatusBottomSheetStateProvider.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/components/express/ExpressStatusBottomSheetStateProvider.kt @@ -72,7 +72,10 @@ class ExpressStatusBottomSheetStateProvider : PreviewParameterProvider