Updated on 2026-08-14
This commit is contained in:
parent
8fef557424
commit
98ba7092e3
6 changed files with 22 additions and 9 deletions
|
|
@ -4,7 +4,6 @@ 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
|
||||
|
|
@ -115,10 +114,6 @@ object NotificationsFactory {
|
|||
}
|
||||
}
|
||||
|
||||
fun MutableList<NotificationUM>.addRequireDestinationFlagErrorNotification() {
|
||||
add(NotificationUM.Error.DestinationMemoRequired)
|
||||
}
|
||||
|
||||
fun MutableList<NotificationUM>.addMinimumAmountErrorNotification(
|
||||
minimumSendAmount: BigDecimal?,
|
||||
sendingAmount: BigDecimal,
|
||||
|
|
@ -516,4 +511,8 @@ object NotificationsFactory {
|
|||
is CryptoCurrency.Token -> isChangeLowerThanDust
|
||||
}
|
||||
}
|
||||
|
||||
private fun MutableList<NotificationUM>.addRequireDestinationFlagErrorNotification() {
|
||||
add(NotificationUM.Error.DestinationMemoRequired)
|
||||
}
|
||||
}
|
||||
|
|
@ -94,6 +94,7 @@ internal class SendConfirmComponent(
|
|||
feeCryptoCurrencyStatus = params.feeCryptoCurrencyStatus,
|
||||
appCurrency = params.appCurrency,
|
||||
destinationAddress = model.enteredDestination.orEmpty(),
|
||||
memo = model.enteredMemo,
|
||||
amountValue = model.enteredAmount.orZero(),
|
||||
reduceAmountBy = model.reduceAmountBy.orZero(),
|
||||
isIgnoreReduce = model.isIgnoreReduce,
|
||||
|
|
|
|||
|
|
@ -131,6 +131,8 @@ internal class SendConfirmModel @Inject constructor(
|
|||
get() = amountState?.isIgnoreReduce == true
|
||||
val enteredDestination: String?
|
||||
get() = destinationUM?.addressTextField?.value
|
||||
val enteredMemo: String?
|
||||
get() = destinationUM?.memoTextField?.value
|
||||
val fee: Fee?
|
||||
get() = feeSelectorUM?.selectedFee
|
||||
val feeError: GetFeeError?
|
||||
|
|
@ -459,6 +461,7 @@ internal class SendConfirmModel @Inject constructor(
|
|||
notificationsUpdateTrigger.triggerUpdate(
|
||||
data = NotificationData(
|
||||
destinationAddress = enteredDestination.orEmpty(),
|
||||
memo = enteredMemo,
|
||||
amountValue = enteredAmount.orZero(),
|
||||
reduceAmountBy = reduceAmountBy.orZero(),
|
||||
isIgnoreReduce = isIgnoreReduce,
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ internal class NotificationsComponent(
|
|||
val feeCryptoCurrencyStatus: CryptoCurrencyStatus,
|
||||
val appCurrency: AppCurrency,
|
||||
val destinationAddress: String,
|
||||
val memo: String?,
|
||||
val amountValue: BigDecimal,
|
||||
val reduceAmountBy: BigDecimal,
|
||||
val isIgnoreReduce: Boolean,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import java.math.BigDecimal
|
|||
|
||||
data class NotificationData(
|
||||
val destinationAddress: String,
|
||||
val memo: String?,
|
||||
val amountValue: BigDecimal,
|
||||
val reduceAmountBy: BigDecimal,
|
||||
val isIgnoreReduce: Boolean,
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ internal class NotificationsModel @Inject constructor(
|
|||
private val appCurrency = params.appCurrency
|
||||
|
||||
private var destinationAddress = params.destinationAddress
|
||||
private var memo = params.memo
|
||||
private var amountValue = params.amountValue
|
||||
private var reduceAmountBy = params.reduceAmountBy
|
||||
private var isIgnoreReduce = params.isIgnoreReduce
|
||||
|
|
@ -110,6 +111,7 @@ internal class NotificationsModel @Inject constructor(
|
|||
|
||||
private suspend fun updateState(data: NotificationData) {
|
||||
destinationAddress = data.destinationAddress
|
||||
memo = data.memo
|
||||
amountValue = data.amountValue
|
||||
reduceAmountBy = data.reduceAmountBy
|
||||
isIgnoreReduce = data.isIgnoreReduce
|
||||
|
|
@ -134,6 +136,7 @@ internal class NotificationsModel @Inject constructor(
|
|||
)
|
||||
addDomainNotifications(
|
||||
destinationAddress = destinationAddress,
|
||||
memo = memo,
|
||||
amountValue = amountValue,
|
||||
reduceAmountBy = reduceAmountBy,
|
||||
fee = fee,
|
||||
|
|
@ -160,6 +163,7 @@ internal class NotificationsModel @Inject constructor(
|
|||
|
||||
private suspend fun MutableList<NotificationUM>.addDomainNotifications(
|
||||
destinationAddress: String,
|
||||
memo: String?,
|
||||
amountValue: BigDecimal,
|
||||
reduceAmountBy: BigDecimal,
|
||||
fee: Fee?,
|
||||
|
|
@ -199,6 +203,8 @@ internal class NotificationsModel @Inject constructor(
|
|||
currencyCheck = currencyCheck,
|
||||
)
|
||||
addWarningNotifications(
|
||||
destinationAddress = destinationAddress,
|
||||
memo = memo,
|
||||
enteredAmount = amountValue,
|
||||
fee = fee,
|
||||
feeValue = feeValue,
|
||||
|
|
@ -288,6 +294,8 @@ internal class NotificationsModel @Inject constructor(
|
|||
}
|
||||
|
||||
private suspend fun MutableList<NotificationUM>.addWarningNotifications(
|
||||
destinationAddress: String,
|
||||
memo: String?,
|
||||
enteredAmount: BigDecimal,
|
||||
sendingAmount: BigDecimal,
|
||||
fee: Fee?,
|
||||
|
|
@ -297,11 +305,11 @@ internal class NotificationsModel @Inject constructor(
|
|||
) {
|
||||
val validationError = validateTransactionUseCase(
|
||||
userWalletId = userWalletId,
|
||||
amount = enteredAmount.convertToSdkAmount(currency),
|
||||
amount = amountValue.convertToSdkAmount(cryptoCurrencyStatus.currency),
|
||||
fee = fee,
|
||||
memo = null,
|
||||
destination = "",
|
||||
network = currency.network,
|
||||
memo = memo,
|
||||
destination = destinationAddress,
|
||||
network = cryptoCurrencyStatus.currency.network,
|
||||
).leftOrNull()
|
||||
|
||||
addRentExemptionNotification(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue