mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-23 03:05:11 +00:00
add note decryption from QR code (#466)
This commit is contained in:
parent
08f1976921
commit
d22738da64
2 changed files with 7 additions and 2 deletions
|
@ -118,6 +118,7 @@ class SendCardState extends State<SendCard>
|
||||||
final paymentRequest = PaymentRequest.fromUri(uri);
|
final paymentRequest = PaymentRequest.fromUri(uri);
|
||||||
addressController.text = paymentRequest.address;
|
addressController.text = paymentRequest.address;
|
||||||
cryptoAmountController.text = paymentRequest.amount;
|
cryptoAmountController.text = paymentRequest.amount;
|
||||||
|
noteController.text = paymentRequest.note;
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
AddressTextFieldOption.paste,
|
AddressTextFieldOption.paste,
|
||||||
|
|
|
@ -1,18 +1,22 @@
|
||||||
class PaymentRequest {
|
class PaymentRequest {
|
||||||
PaymentRequest(this.address, this.amount);
|
PaymentRequest(this.address, this.amount, this.note);
|
||||||
|
|
||||||
factory PaymentRequest.fromUri(Uri uri) {
|
factory PaymentRequest.fromUri(Uri uri) {
|
||||||
var address = "";
|
var address = "";
|
||||||
var amount = "";
|
var amount = "";
|
||||||
|
var note = "";
|
||||||
|
|
||||||
if (uri != null) {
|
if (uri != null) {
|
||||||
address = uri.path;
|
address = uri.path;
|
||||||
amount = uri.queryParameters['tx_amount'] ?? uri.queryParameters['amount'] ?? "";
|
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 address;
|
||||||
final String amount;
|
final String amount;
|
||||||
|
final String note;
|
||||||
}
|
}
|
Loading…
Reference in a new issue