Updated on 2026-08-14
This commit is contained in:
parent
9b4b339b8d
commit
d84b06f80d
4 changed files with 25 additions and 3 deletions
|
|
@ -159,6 +159,11 @@ sealed class NotificationUM(val config: NotificationConfig) {
|
|||
),
|
||||
subtitle = resourceReference(id = R.string.send_notification_invalid_reserve_amount_text),
|
||||
)
|
||||
|
||||
data object DestinationMemoRequired : Error(
|
||||
title = resourceReference(id = R.string.send_validation_destination_tag_required_title),
|
||||
subtitle = resourceReference(id = R.string.send_validation_destination_tag_required_description),
|
||||
)
|
||||
}
|
||||
|
||||
open class Warning(
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.tangem.blockchain.common.BlockchainSdkError
|
|||
import com.tangem.common.ui.R
|
||||
import com.tangem.common.ui.amountScreen.models.AmountFieldModel
|
||||
import com.tangem.common.ui.amountScreen.utils.getFiatString
|
||||
import com.tangem.common.ui.notifications.NotificationsFactory.addRequireDestinationFlagErrorNotification
|
||||
import com.tangem.core.ui.extensions.networkIconResId
|
||||
import com.tangem.core.ui.format.bigdecimal.crypto
|
||||
import com.tangem.core.ui.format.bigdecimal.format
|
||||
|
|
@ -112,6 +113,10 @@ object NotificationsFactory {
|
|||
}
|
||||
}
|
||||
|
||||
fun MutableList<NotificationUM>.addRequireDestinationFlagErrorNotification() {
|
||||
add(NotificationUM.Error.DestinationMemoRequired)
|
||||
}
|
||||
|
||||
fun MutableList<NotificationUM>.addMinimumAmountErrorNotification(
|
||||
minimumSendAmount: BigDecimal?,
|
||||
sendingAmount: BigDecimal,
|
||||
|
|
@ -326,6 +331,9 @@ object NotificationsFactory {
|
|||
error = validationError,
|
||||
onReduceClick = onReduceClick,
|
||||
)
|
||||
is BlockchainSdkError.XRP -> addXRPTransactionValidationError(
|
||||
error = validationError,
|
||||
)
|
||||
null -> minAdaValue?.let {
|
||||
add(
|
||||
NotificationUM.Cardano.MinAdaValueCharged(
|
||||
|
|
@ -406,6 +414,12 @@ object NotificationsFactory {
|
|||
}
|
||||
}
|
||||
|
||||
private fun MutableList<NotificationUM>.addXRPTransactionValidationError(error: BlockchainSdkError.XRP) {
|
||||
when (error) {
|
||||
is BlockchainSdkError.XRP.DestinationMemoRequired -> addRequireDestinationFlagErrorNotification()
|
||||
}
|
||||
}
|
||||
|
||||
fun MutableList<NotificationUM>.addRentExemptionNotification(rentWarning: CryptoCurrencyWarning.Rent?) {
|
||||
if (rentWarning == null) return
|
||||
add(NotificationUM.Solana.RentInfo(rentWarning))
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ internal class SendNotificationFactory(
|
|||
val sendState = state.sendState ?: return@map persistentListOf()
|
||||
val feeState = state.getFeeState(isEditState) ?: return@map persistentListOf()
|
||||
val amountState = state.getAmountState(isEditState) as? AmountState.Data ?: return@map persistentListOf()
|
||||
val recipientState = state.getRecipientState(isEditState)
|
||||
|
||||
val amountValue = amountState.amountTextField.cryptoAmount.value.orZero()
|
||||
val feeValue = feeState.fee?.amount?.value.orZero()
|
||||
|
|
@ -118,6 +119,7 @@ internal class SendNotificationFactory(
|
|||
)
|
||||
addWarningNotifications(
|
||||
amountState = amountState,
|
||||
recipientState = recipientState,
|
||||
feeState = feeState,
|
||||
sendState = sendState,
|
||||
sendingAmount = sendingAmount,
|
||||
|
|
@ -233,6 +235,7 @@ internal class SendNotificationFactory(
|
|||
|
||||
private suspend fun MutableList<NotificationUM>.addWarningNotifications(
|
||||
amountState: AmountState.Data,
|
||||
recipientState: SendStates.RecipientState?,
|
||||
feeState: SendStates.FeeState,
|
||||
sendState: SendStates.SendState,
|
||||
sendingAmount: BigDecimal,
|
||||
|
|
@ -247,8 +250,8 @@ internal class SendNotificationFactory(
|
|||
userWalletId = userWalletId,
|
||||
amount = amountValue.convertToSdkAmount(cryptoCurrencyStatus.currency),
|
||||
fee = feeState.fee,
|
||||
memo = null,
|
||||
destination = "",
|
||||
memo = recipientState?.memoTextField?.value.orEmpty(),
|
||||
destination = recipientState?.addressTextField?.value.orEmpty(),
|
||||
network = cryptoCurrencyStatus.currency.network,
|
||||
).leftOrNull()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
[versions]
|
||||
tangemBlockchainSdk = "develop-988"
|
||||
tangemBlockchainSdk = "develop-989"
|
||||
#tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds
|
||||
tangemCardSdk = "develop-444"
|
||||
#tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue