Updated on 2026-08-14
This commit is contained in:
commit
f6b463c9cf
3 changed files with 18 additions and 8 deletions
|
|
@ -228,9 +228,13 @@ sealed class NotificationUM(val config: NotificationConfig) {
|
|||
),
|
||||
)
|
||||
|
||||
data class OnrampErrorNotification(val onRefresh: () -> Unit) : Warning(
|
||||
data class OnrampErrorNotification(val errorCode: String?, val onRefresh: () -> Unit) : Warning(
|
||||
title = resourceReference(R.string.common_error),
|
||||
subtitle = resourceReference(R.string.common_unknown_error),
|
||||
subtitle = if (errorCode != null) {
|
||||
resourceReference(R.string.express_error_code, wrappedList(errorCode))
|
||||
} else {
|
||||
resourceReference(R.string.common_unknown_error)
|
||||
},
|
||||
buttonsState = NotificationConfig.ButtonsState.SecondaryButtonConfig(
|
||||
text = resourceReference(R.string.warning_button_refresh),
|
||||
onClick = onRefresh,
|
||||
|
|
|
|||
|
|
@ -49,9 +49,8 @@ internal class OnrampStateFactory(
|
|||
fun getOnrampErrorState(onrampError: OnrampError): OnrampMainComponentUM {
|
||||
return when (onrampError) {
|
||||
OnrampError.PairsNotFound -> getNoPairsErrorState()
|
||||
is OnrampError.DataError,
|
||||
is OnrampError.DomainError,
|
||||
-> getErrorState()
|
||||
is OnrampError.DataError -> getErrorState(onrampError.code)
|
||||
is OnrampError.DomainError -> getErrorState()
|
||||
is OnrampError.AmountError.TooBigError,
|
||||
is OnrampError.AmountError.TooSmallError,
|
||||
OnrampError.RedirectError.VerificationFailed,
|
||||
|
|
@ -75,7 +74,7 @@ internal class OnrampStateFactory(
|
|||
)
|
||||
}
|
||||
|
||||
private fun getErrorState(): OnrampMainComponentUM {
|
||||
private fun getErrorState(errorCode: String? = null): OnrampMainComponentUM {
|
||||
val state = currentStateProvider()
|
||||
val endButton = state.topBarConfig.endButtonUM.copy(enabled = true)
|
||||
|
||||
|
|
@ -87,10 +86,16 @@ internal class OnrampStateFactory(
|
|||
amountFieldModel = state.amountBlockState.amountFieldModel.copy(isError = true),
|
||||
),
|
||||
providerBlockState = OnrampProviderBlockUM.Empty,
|
||||
errorNotification = NotificationUM.Warning.OnrampErrorNotification(onrampIntents::onRefresh),
|
||||
errorNotification = NotificationUM.Warning.OnrampErrorNotification(
|
||||
errorCode = errorCode,
|
||||
onRefresh = onrampIntents::onRefresh,
|
||||
),
|
||||
)
|
||||
is OnrampMainComponentUM.InitialLoading -> state.copy(
|
||||
errorNotification = NotificationUM.Warning.OnrampErrorNotification(onrampIntents::onRefresh),
|
||||
errorNotification = NotificationUM.Warning.OnrampErrorNotification(
|
||||
errorCode = errorCode,
|
||||
onRefresh = onrampIntents::onRefresh,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,6 +202,7 @@ internal class OnrampMainComponentModel @Inject constructor(
|
|||
val bestProvider = quote as? OnrampQuote.Data
|
||||
val isMultipleQuotes = !quotes.isSingleItem()
|
||||
val isOtherQuotesHasData = quotes
|
||||
.filter { it.paymentMethod == quote.paymentMethod }
|
||||
.filterNot { it == bestProvider }
|
||||
.any { it is OnrampQuote.Data }
|
||||
val hasBestProvider = isMultipleQuotes && isOtherQuotesHasData
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue