Updated on 2026-08-14

This commit is contained in:
Tangem 2026-05-27 19:43:31 +05:00
parent a2b99aa465
commit 9be9f8f3e7
6 changed files with 774 additions and 33 deletions

View file

@ -160,8 +160,9 @@ internal class DefaultSwapComponent @AssistedInject constructor(
val isPermissionNotReady = loadedState?.permissionState !is PermissionDataState.Empty
val isInTransferMode = dataState.currentTransferState != null
val isSwapNotReady = !isInTransferMode && (isProviderMissing || isPermissionNotReady)
val isTangemPayWithdrawal = model.isTangemPayWithdrawal()
isAmountEmptyOrZero || isInsufficientFunds || isSwapNotReady
isAmountEmptyOrZero || isInsufficientFunds || isSwapNotReady || isTangemPayWithdrawal
}
}

View file

@ -1924,7 +1924,7 @@ internal class SwapModel @Inject constructor(
)
}
private fun isTangemPayWithdrawal(): Boolean {
fun isTangemPayWithdrawal(): Boolean {
return tangemPayInput?.isWithdrawal == true || dataState.fromSwapCurrencyStatus?.account is Account.Payment
}

View file

@ -497,6 +497,7 @@ internal class StateBuilder(
}
}
val priceImpact = quoteModel.priceImpact
val isTangemPayWithdrawal = fromSwapCurrencyStatus.account is Account.Payment
return uiStateHolder.copy(
sendCardData = SwapCardState.SwapCardData(
type = sendInput,
@ -550,7 +551,12 @@ internal class StateBuilder(
),
swapButton = SwapButton(
walletInteractionIcon = walletInterationIcon(fromSwapCurrencyStatus.userWallet),
isEnabled = getSwapButtonEnabled(notifications, priceImpact, swapFee),
isEnabled = getSwapButtonEnabled(
notifications = notifications,
priceImpact = priceImpact,
swapFee = swapFee,
isTangemPayWithdrawal = isTangemPayWithdrawal,
),
isHoldToConfirm = fromSwapCurrencyStatus.userWallet.isHotWallet,
onClick = actions.onSwapClick,
),
@ -631,8 +637,10 @@ internal class StateBuilder(
notifications: ImmutableList<NotificationUM>,
priceImpact: PriceImpact,
swapFee: SwapFee?,
isTangemPayWithdrawal: Boolean,
): Boolean {
return swapFee != null && notifications.none { notification ->
val isSwapTxReady = isTangemPayWithdrawal || swapFee != null
return isSwapTxReady && notifications.none { notification ->
notification is SwapNotificationUM.Error || notification is NotificationUM.Error ||
notification is SwapNotificationUM.Warning.ExpressErrorWarning ||
notification is SwapNotificationUM.Warning.ExpressGeneralError ||