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

xmr: UI QR code fix, zoom by swipe #1074

Closed
wants to merge 1 commit into from

Conversation

ph4r05
Copy link
Contributor

@ph4r05 ph4r05 commented Jun 18, 2020

This is a draft PR addressing monero-project/monero-gui#2960 (reported by @bosomt) by:

  • Showing down-scaled QR code so controls are clearly visible
  • Enabling to zoom the QR code by swiping in any direction to up-scale to full-screen

Current state:

Screen where user can activate the QR code screen:
Screenshot 2020-06-18 at 14 46 01

Initial QR screen state
Screenshot 2020-06-18 at 15 04 41
Zoomed QR code after swiping to any direction (scale = 5)
Screenshot 2020-06-18 at 15 04 46

After another swipe the scale returns back to 3 (swipe toggles between 3 and 5)

This is just an idea of how to address this issue, it can be probably implemented in a more elegant way.

Edit: I've added a new scroll-bar to give a user a hint this view is scrollable. I had to offset to the right so it does not collide with the QR code.

@ph4r05 ph4r05 requested a review from onvej-sl as a code owner June 18, 2020 12:58
@ph4r05 ph4r05 force-pushed the pr/004-xmr-qr-scrollzoom branch from 1e3a621 to efe15fd Compare June 18, 2020 13:06
Comment on lines +44 to +60
def render_scrollbar(pages: int, page: int) -> None:
BBOX = const(220)
SIZE = const(8)

padding = 14
if pages * padding > BBOX:
padding = BBOX // pages

X = const(232)
Y = (BBOX // 2) - (pages // 2) * padding

for i in range(0, pages):
if i == page:
fg = ui.FG
else:
fg = ui.GREY
ui.display.bar_radius(X, Y + i * padding, SIZE, SIZE, fg, ui.BG, 4)
Copy link
Contributor Author

@ph4r05 ph4r05 Jun 18, 2020

Choose a reason for hiding this comment

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

Only X was changed in this code compared to the render_scrollbar from trezor/ui/scroll.py.

Question: Do you prefer to

  • a) extend the original function so X can be passed as a param (I assume no as it complicates API for just this use-case) or
  • b) copy the code locally with minor modification?

@tsusanka tsusanka added this to the 2020-07 milestone Jun 19, 2020
@rating89us
Copy link

rating89us commented Jun 19, 2020

  • I think the green button under the enlarged QR code shouldn't appear:
    image

  • I like the scroll bar with two vertical dots, but I was expecting that the QR code would resize only with swipe up/down, and not in every direction. As a user, when I see this scroll bar I expect page 1 = small QR code, page 2 (below page 1) = large QR code.

@ph4r05 ph4r05 force-pushed the pr/004-xmr-qr-scrollzoom branch from efe15fd to ee7a4e7 Compare June 23, 2020 12:47
@ph4r05
Copy link
Contributor Author

ph4r05 commented Jun 23, 2020

@rating89us

ad 1 - I've added a change that shows buttons only for the small QR code version. However, such changes to the underlying Confirmation dialog may be harder to maintain so I would not be surprised if we just choose to keep the buttons there w.r.t. change costs.

ad 2 - I like the variant with all gestures toggling the QR code sizes as there is IMO a higher chance user will get the control logic right faster. Any swipe toggles the state. As there are just 2 I don't see a reason why it should be more strict.

@prusnak prusnak requested review from tsusanka and removed request for onvej-sl June 24, 2020 12:05
@prusnak
Copy link
Member

prusnak commented Jun 24, 2020

@tsusanka Can you please discuss this with the product how do you want his to be implemented?

@prusnak prusnak added the feature Product related issue visible for end user label Jun 24, 2020
@bosomt
Copy link

bosomt commented Jun 26, 2020

current master f382f77 changed overlay of buttons
so now QR code for Monero is not readable by QR code reader

image

@onvej-sl
Copy link
Contributor

current master f382f77 changed overlay of buttons
so now QR code for Monero is not readable by QR code reader

I think the fix proposed by ph4r05 fixes it.

@tsusanka
Copy link
Contributor

tsusanka commented Jun 29, 2020

@ph4r05 can't we simply keep the down-scaled QR image and that's it? As in:

Screenshot 2020-06-18 at 15 04 41

without any pagination whatsoever. It seems to be readable just fine by my phone.

@ph4r05
Copy link
Contributor Author

ph4r05 commented Jun 30, 2020

@tsusanka if it is readable fine in scale=3, I don't have a strong preference so you can close the PR and change scale from 4 to 3.

@tsusanka
Copy link
Contributor

tsusanka commented Jul 1, 2020

I have tested it with two phone cameras and both were just fine with scale=3. So I am closing this, thanks @ph4r05. Fixed via 0f9a245.

@tsusanka tsusanka closed this Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Product related issue visible for end user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants