Updated on 2026-08-14

This commit is contained in:
Tangem 2025-01-13 21:06:08 +05:00
parent 4ff11f2040
commit ad23dce132
4 changed files with 46 additions and 31 deletions

View file

@ -6,23 +6,27 @@ import com.tangem.core.ui.extensions.resourceReference
object ExpressNotificationsUM {
data class NeedVerification(val onGoToProviderClick: () -> Unit) : NotificationUM.Warning(
data class NeedVerification(val onGoToProviderClick: (() -> Unit)?) : NotificationUM.Warning(
title = resourceReference(R.string.express_exchange_notification_verification_title),
subtitle = resourceReference(R.string.express_exchange_notification_verification_text),
iconResId = R.drawable.ic_alert_triangle_20,
buttonsState = NotificationConfig.ButtonsState.SecondaryButtonConfig(
text = resourceReference(R.string.common_go_to_provider),
onClick = onGoToProviderClick,
),
buttonsState = onGoToProviderClick?.let { onClick ->
NotificationConfig.ButtonsState.SecondaryButtonConfig(
text = resourceReference(R.string.common_go_to_provider),
onClick = onClick,
)
},
)
data class FailedByProvider(val onGoToProviderClick: () -> Unit) : NotificationUM.Error(
data class FailedByProvider(val onGoToProviderClick: (() -> Unit)?) : NotificationUM.Error(
title = resourceReference(R.string.express_exchange_notification_failed_title),
subtitle = resourceReference(R.string.express_exchange_notification_failed_text),
iconResId = R.drawable.ic_alert_circle_24,
buttonState = NotificationConfig.ButtonsState.SecondaryButtonConfig(
text = resourceReference(R.string.common_go_to_provider),
onClick = onGoToProviderClick,
),
buttonState = onGoToProviderClick?.let { onClick ->
NotificationConfig.ButtonsState.SecondaryButtonConfig(
text = resourceReference(R.string.common_go_to_provider),
onClick = onClick,
)
},
)
}

View file

@ -52,22 +52,27 @@ internal class SetOnrampSuccessContentConverter(
}
private fun getNotification(status: OnrampStatus.Status, externalTxUrl: String?): NotificationUM? {
if (externalTxUrl == null) return null
return when (status) {
OnrampStatus.Status.Verifying -> {
ExpressNotificationsUM.NeedVerification {
goToProviderClick(externalTxUrl)
}
ExpressNotificationsUM.NeedVerification(
onGoToProviderClick = onProviderClick(externalTxUrl),
)
}
OnrampStatus.Status.Failed -> {
ExpressNotificationsUM.FailedByProvider {
goToProviderClick(externalTxUrl)
}
ExpressNotificationsUM.FailedByProvider(
onGoToProviderClick = onProviderClick(externalTxUrl),
)
}
else -> null
}
}
private fun onProviderClick(externalTxUrl: String?) = if (externalTxUrl != null) {
{ goToProviderClick(externalTxUrl) }
} else {
null
}
private fun convertStatuses(status: OnrampStatus.Status, externalTxUrl: String?): ExpressStatusUM {
val statuses = with(status) {
persistentListOf(

View file

@ -108,23 +108,24 @@ internal class TokenDetailsOnrampTransactionStateConverter(
externalTxUrl: String?,
providerName: String,
): NotificationUM? {
if (externalTxUrl == null) return null
return when (status) {
OnrampStatus.Status.Verifying -> {
analyticsEventHandler.send(TokenOnrampAnalyticsEvent.NoticeKYC(cryptoCurrency.symbol, providerName))
ExpressNotificationsUM.NeedVerification {
clickIntents.onGoToProviderClick(externalTxUrl)
}
ExpressNotificationsUM.NeedVerification(onGoToProviderClick = onProviderClick(externalTxUrl))
}
OnrampStatus.Status.Failed -> {
ExpressNotificationsUM.FailedByProvider {
clickIntents.onGoToProviderClick(externalTxUrl)
}
ExpressNotificationsUM.FailedByProvider(onGoToProviderClick = onProviderClick(externalTxUrl))
}
else -> null
}
}
private fun onProviderClick(externalTxUrl: String?) = if (externalTxUrl != null) {
{ clickIntents.onGoToProviderClick(externalTxUrl) }
} else {
null
}
private fun getIconState(status: OnrampStatus.Status): ExpressTransactionStateIconUM {
return when (status) {
OnrampStatus.Status.Verifying -> ExpressTransactionStateIconUM.Warning

View file

@ -117,25 +117,30 @@ internal class SingleWalletOnrampTransactionConverter(
externalTxUrl: String?,
providerName: String,
): NotificationUM? {
if (externalTxUrl == null) return null
return when (status) {
OnrampStatus.Status.Verifying -> {
analyticsEventHandler.send(
TokenOnrampAnalyticsEvent.NoticeKYC(currency.symbol, providerName),
)
ExpressNotificationsUM.NeedVerification {
clickIntents.onGoToProviderClick(externalTxUrl)
}
ExpressNotificationsUM.NeedVerification(
onGoToProviderClick = onProviderClick(externalTxUrl),
)
}
OnrampStatus.Status.Failed -> {
ExpressNotificationsUM.FailedByProvider {
clickIntents.onGoToProviderClick(externalTxUrl)
}
ExpressNotificationsUM.FailedByProvider(
onGoToProviderClick = onProviderClick(externalTxUrl),
)
}
else -> null
}
}
private fun onProviderClick(externalTxUrl: String?) = if (externalTxUrl != null) {
{ clickIntents.onGoToProviderClick(externalTxUrl) }
} else {
null
}
private fun getIconState(status: OnrampStatus.Status): ExpressTransactionStateIconUM {
return when (status) {
OnrampStatus.Status.Verifying -> ExpressTransactionStateIconUM.Warning