From d22738da6477e6f0894bd934b9e4a2a61aa5538d Mon Sep 17 00:00:00 2001 From: Serhii Date: Thu, 11 Aug 2022 17:40:38 +0300 Subject: [PATCH] add note decryption from QR code (#466) --- lib/src/screens/send/widgets/send_card.dart | 1 + lib/utils/payment_request.dart | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/src/screens/send/widgets/send_card.dart b/lib/src/screens/send/widgets/send_card.dart index 69858a3ac..e3cc3a2c4 100644 --- a/lib/src/screens/send/widgets/send_card.dart +++ b/lib/src/screens/send/widgets/send_card.dart @@ -118,6 +118,7 @@ class SendCardState extends State final paymentRequest = PaymentRequest.fromUri(uri); addressController.text = paymentRequest.address; cryptoAmountController.text = paymentRequest.amount; + noteController.text = paymentRequest.note; }, options: [ AddressTextFieldOption.paste, diff --git a/lib/utils/payment_request.dart b/lib/utils/payment_request.dart index d4338a39a..26244059f 100644 --- a/lib/utils/payment_request.dart +++ b/lib/utils/payment_request.dart @@ -1,18 +1,22 @@ class PaymentRequest { - PaymentRequest(this.address, this.amount); + PaymentRequest(this.address, this.amount, this.note); factory PaymentRequest.fromUri(Uri uri) { var address = ""; var amount = ""; + var note = ""; if (uri != null) { address = uri.path; amount = uri.queryParameters['tx_amount'] ?? uri.queryParameters['amount'] ?? ""; + note = uri.queryParameters['tx_description'] + ?? uri.queryParameters['message'] ?? ""; } - return PaymentRequest(address, amount); + return PaymentRequest(address, amount, note); } final String address; final String amount; + final String note; } \ No newline at end of file