diff --git a/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationsFactory.kt b/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationsFactory.kt index 55ee3a6906..008a2665bd 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationsFactory.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationsFactory.kt @@ -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.addRequireDestinationFlagErrorNotification() { - add(NotificationUM.Error.DestinationMemoRequired) - } - fun MutableList.addMinimumAmountErrorNotification( minimumSendAmount: BigDecimal?, sendingAmount: BigDecimal, @@ -516,4 +511,8 @@ object NotificationsFactory { is CryptoCurrency.Token -> isChangeLowerThanDust } } + + private fun MutableList.addRequireDestinationFlagErrorNotification() { + add(NotificationUM.Error.DestinationMemoRequired) + } } \ No newline at end of file diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/confirm/SendConfirmComponent.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/confirm/SendConfirmComponent.kt index 3ed30ca608..ff6ba04840 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/confirm/SendConfirmComponent.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/confirm/SendConfirmComponent.kt @@ -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, diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/confirm/model/SendConfirmModel.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/confirm/model/SendConfirmModel.kt index 7e089f9d66..e09a1175f2 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/confirm/model/SendConfirmModel.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/confirm/model/SendConfirmModel.kt @@ -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, diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/notifications/NotificationsComponent.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/notifications/NotificationsComponent.kt index a7a941c816..14760575ab 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/notifications/NotificationsComponent.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/notifications/NotificationsComponent.kt @@ -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, diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/notifications/model/NotificationData.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/notifications/model/NotificationData.kt index adf6dc6e5f..bf7e440869 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/notifications/model/NotificationData.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/notifications/model/NotificationData.kt @@ -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, diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/notifications/model/NotificationsModel.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/notifications/model/NotificationsModel.kt index 9ff6f21955..b27fefd5e3 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/notifications/model/NotificationsModel.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/notifications/model/NotificationsModel.kt @@ -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.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.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(