Skip to content
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

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

pythcoiner
Copy link
Collaborator

fix #949:

  • Remove Qr code from view
  • Add a button Show QR Code that display the QRCode in a new modal
  • Increased size of Qr Code as we now have more room

image

image

Copy link
Member

@edouardparis edouardparis left a 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 👍

@@ -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();
Copy link
Member

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())

@@ -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();
Copy link
Member

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)


impl ShowQrCodeModal {
pub fn new(qr: qr_code::State) -> Self {
Self { qr_code: qr }
Copy link
Member

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

@jp1ac4
Copy link
Collaborator

jp1ac4 commented Mar 5, 2024

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.

@pythcoiner
Copy link
Collaborator Author

adressed comments, here how it looks now:

qr_modal

@edouardparis
Copy link
Member

Seems good, only need a rebase 👍

@pythcoiner
Copy link
Collaborator Author

rebased on master

Copy link
Member

@edouardparis edouardparis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK e38c5f1

@edouardparis edouardparis merged commit 1310896 into wizardsardine:master Mar 15, 2024
21 checks passed
@pythcoiner pythcoiner deleted the modal_qrcode branch March 26, 2024 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

QRCode displayed only for last address
3 participants