Updated on 2026-08-14
This commit is contained in:
parent
a2b99aa465
commit
9be9f8f3e7
6 changed files with 774 additions and 33 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 ||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue