wormhole-william-mobile icon indicating copy to clipboard operation
wormhole-william-mobile copied to clipboard

Adds QR code generation for sends

Open xxxserxxx opened this issue 1 year ago • 2 comments

This implements #28. I've done no testing on mobile, but:

  1. It uses a QR library from rsc, which has no C dependencies
  2. It works running the patched app on my laptop, generating QR codes, and receiving (by scannang the codes) from the wormhole-william-mobile app on my phone
  3. I have no reason to expect -- given the simplicity of my changes, and of rsc's QR library -- that it won't work once it's on a mobile device

The QR codes are small, but they scan, and it works as-is. I don't have the Android SDK currently installed on my laptop because it's enormous.

Anyhoo, you said you'd be happy to have a patch for #28, so here it is.

xxxserxxx avatar Nov 12 '22 23:11 xxxserxxx

Thanks for this! Overall the code looks good.

It doesn't look like the QR code is being hidden after the transfer has begun. We should use the same logic used for showing and hiding the text transfer code.

The QR code ends up looking blurry on my phone (it still scans). I'm not sure what the cause of that is but it seems like that should be fixable. I think we should also make the image larger. Either some reasonable minimal width or size it based on the size of the viewport.

psanford avatar Nov 21 '22 19:11 psanford

I am very unfamiliar with the gioui library, and it's not a trivial library to get into, so I was trying to make the patch as small as possible.

I see what you mean about hiding the QR. Noted.

There's a scaling variable in the QR library (used at ui/ui.go#251), but it doesn't actually scale the pixels; it just makes the image bounds larger. I'm either missing something in the lib API, or we have to manually scale the image.

I see a fuzzy QR as well on the desktop. The only thing I can think that would cause blurriness is if something in the image processing was resulting in a lossy image. It might be worth running a test on the qr library by itself and see how the images it produces look without being filtered through gioui.

I'm going to be unable to work on this for another week or so, but I'll poke around with it when I get back.

xxxserxxx avatar Nov 21 '22 20:11 xxxserxxx