add note decryption from QR code (#466)

Serhii committed Aug 11, 2022 at 17:40 UTC d22738da6477e6f0894bd934b9e4a2a61aa5538d
2 files changed +7 -2
lib/src/screens/send/widgets/send_card.dart
+1
@@ -118,6 +118,7 @@ class SendCardState extends State<SendCard>
118 final paymentRequest = PaymentRequest.fromUri(uri);
119 addressController.text = paymentRequest.address;
120 cryptoAmountController.text = paymentRequest.amount;
121 + noteController.text = paymentRequest.note;
122 },
123 options: [
124 AddressTextFieldOption.paste,
lib/utils/payment_request.dart
+6 -2
@@ -1,18 +1,22 @@
1 class PaymentRequest {
2 - PaymentRequest(this.address, this.amount);
2 + PaymentRequest(this.address, this.amount, this.note);
3
4 factory PaymentRequest.fromUri(Uri uri) {
5 var address = "";
6 var amount = "";
7 + var note = "";
8
9 if (uri != null) {
10 address = uri.path;
11 amount = uri.queryParameters['tx_amount'] ?? uri.queryParameters['amount'] ?? "";
12 + note = uri.queryParameters['tx_description']
13 + ?? uri.queryParameters['message'] ?? "";
14 }
15
13 - return PaymentRequest(address, amount);
16 + return PaymentRequest(address, amount, note);
17 }
18
19 final String address;
20 final String amount;
21 + final String note;
22 }
\ No newline at end of file