Updated on 2026-08-14
This commit is contained in:
parent
9cd92c0def
commit
7dfff7c34f
5 changed files with 27 additions and 14 deletions
|
|
@ -916,6 +916,7 @@
|
|||
<string name="organize_tokens_sort_by_balance">By balance</string>
|
||||
<string name="organize_tokens_title">Organize tokens</string>
|
||||
<string name="organize_tokens_ungroup">Ungroup</string>
|
||||
<string name="provider_name_support">%s support</string>
|
||||
<string name="push_notifications_more_info">More info</string>
|
||||
<string name="push_notifications_permission_alert_description">You can enable Notifications for Tangem in Settings.</string>
|
||||
<string name="push_notifications_permission_alert_negative_button">Enable Later</string>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,10 @@ class ExpressStatusBottomSheetStateProvider : PreviewParameterProvider<ExpressSt
|
|||
isDone = false,
|
||||
),
|
||||
),
|
||||
notification = ExchangeStatusNotification.LongTimeExchange {},
|
||||
notification = ExchangeStatusNotification.LongTimeExchange(
|
||||
onGoToProviderClick = {},
|
||||
providerName = "Unlimit",
|
||||
),
|
||||
showProviderLink = false,
|
||||
fromCryptoCurrency = token,
|
||||
toCryptoCurrency = token,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue