Updated on 2026-08-14

This commit is contained in:
Tangem 2024-04-17 12:04:24 +05:00
parent 6a984ed75d
commit 741b6702ce
2 changed files with 6 additions and 4 deletions

View file

@ -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)
}
}
}

View file

@ -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 = {