-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GUI] Move qr code to modal #991
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the enum way of the change 👍
gui/src/app/state/receive.rs
Outdated
@@ -154,12 +155,20 @@ impl State for ReceivePanel { | |||
)); | |||
Command::none() | |||
} | |||
Message::View(view::Message::ShowQrCode(i)) => { | |||
let address = self.addresses.list.get(i).expect("Must be present").clone(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is unexpected to happen, but it is safer to do the if let Some(address) = self.address.get(i).as_ref()
(I think as_ref
will help us to not use .clone()
)
gui/src/app/state/receive.rs
Outdated
@@ -154,12 +155,20 @@ impl State for ReceivePanel { | |||
)); | |||
Command::none() | |||
} | |||
Message::View(view::Message::ShowQrCode(i)) => { | |||
let address = self.addresses.list.get(i).expect("Must be present").clone(); | |||
let qr_code = qr_code::State::new(format!("bitcoin:{}?index={}", address, i)).ok(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move this code in the ShowQrCodeModal::new(address, index) -> Option<ShowQrCodeModal>
and do self.modal = ShowQrCodeModal::new(address, i)
gui/src/app/state/receive.rs
Outdated
|
||
impl ShowQrCodeModal { | ||
pub fn new(qr: qr_code::State) -> Self { | ||
Self { qr_code: qr } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
qr_code::State::new(format!("bitcoin:{}?index={}", address, i)).ok().map(|qr_code| Self{qr_code})
Do you think it would be worth also showing the address below the QR code in the modal? It could be reassuring to the user in case several addresses have been generated on the screen and they forget which one they clicked on. |
743f785
to
19897db
Compare
Seems good, only need a rebase 👍 |
19897db
to
e38c5f1
Compare
rebased on master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK e38c5f1
fix #949:
Show QR Code
that display the QRCode in a new modal