From 741b6702cee048a9285e4ca9df207973bfcbe24e Mon Sep 17 00:00:00 2001 From: Tangem Date: Wed, 17 Apr 2024 12:04:24 +0500 Subject: [PATCH] Updated on 2026-08-14 --- .../tangem/features/send/impl/presentation/SendFragment.kt | 4 ++-- .../send/impl/presentation/viewmodel/SendViewModel.kt | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/SendFragment.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/SendFragment.kt index cebe88712f..64e8f1e992 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/SendFragment.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/SendFragment.kt @@ -92,9 +92,9 @@ internal class SendFragment : ComposeFragment() { delay(QR_SCAN_DELAY) // Delayed launch is needed in order for the UI to be drawn and to process the sent events. - // If do not use the delay, then etAmount error field is not displayed when + // If do not use the delay, then error field is not displayed when // inserting an incorrect amount by shareUri - viewModel.onRecipientAddressScanned(it) + viewModel.onQrCodeScanned(it) } } } diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/viewmodel/SendViewModel.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/viewmodel/SendViewModel.kt index 2d397422cf..ffad3f3633 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/viewmodel/SendViewModel.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/viewmodel/SendViewModel.kt @@ -569,12 +569,14 @@ internal class SendViewModel @Inject constructor( // endregion // region recipient state clicks - fun onRecipientAddressScanned(address: String) { + fun onQrCodeScanned(address: String) { viewModelScope.launch(dispatchers.main) { parseQrCodeUseCase(address, cryptoCurrency).fold( ifRight = { parsedCode -> onRecipientAddressValueChange(parsedCode.address, EnterAddressSource.QRCode) - parsedCode.amount?.let { onAmountValueChange(it.toPlainString()) } + parsedCode.amount?.let { + onAmountValueChange(it.parseBigDecimal(decimals = cryptoCurrency.decimals)) + } parsedCode.memo?.let { onRecipientMemoValueChange(it) } }, ifLeft = {