michaeltroger / greenpass-android

Green Pass PDF Wallet Android App
https://play.google.com/store/apps/details?id=com.michaeltroger.gruenerpass
GNU General Public License v3.0
62 stars 2 forks source link

[BUG] Aztec code from D-Ticket not recognized #251

Open revuwa opened 2 weeks ago

revuwa commented 2 weeks ago

Describe the bug Thanks a lot for the experimental support of Aztec codes ️❤️ Am I the only one who have trouble getting the code of D-Tickets (Deutschland from Deutsche Bahn) recognized? Even if I zoom in extremely, there is no chance to workaround.

To Reproduce

  1. Open the app.
  2. Add a D-Ticket (with Aztec code)
  3. Zoom as much as you like, all day long
  4. Scratch your head why the code could not be recognized

Expected behavior Maybe it's just me or my understanding of what the app should do. But I thought, the (Aztec) code should be "extracted" and shown as a bigger version on top of app. But this not happens. It's just opens the D-Ticket and shows it as every other PDF app does.

Screenshots image Of course the distortion was added later, for the screenshot.

Smartphone (please complete the following information):

michaeltroger commented 1 week ago

Hi! Thank you for reporting! The ideal, expected behavior is that a document like: https://github.com/michaeltroger/greenpass-android/blob/main/testdata/aztec.pdf gets displayed like: https://github.com/michaeltroger/greenpass-android/blob/main/screenshots/aztec_code.png

The zooming that you can do on the document has no impact on the detection though.

Personally I don't have any D-Ticket by hand. Therefore your screenshot was super valuable for trying to reproduce it. I can reproduce no detection happening with an Aztec code holding 652 characters: aztec-dticket-demo_652.pdf

However the detection works if the barcode only holds 323 characters: aztec-dticket-demo_323.pdf

michaeltroger commented 1 week ago

With the attached fix the issue gets fixed for me. Could you verify that it works on the D-Ticket with this test version? Note: This setting (increased image resolution) would slow down the loading performance significantly though.

If you're a programmer then you can build the test app from this branch. Alternatively you can install the test version from an APK file here: https://github.com/michaeltroger/greenpass-android/actions/runs/8976793372/artifacts/1478226889 (it's a zip file that first needs to get extracted)

Please note that installing a test version (debug build) of the app, will make you loose all your app's data.

revuwa commented 1 week ago

With the attached fix the issue gets fixed for me. Could you verify that it works on the D-Ticket with this test version? Note: This setting (increased image resolution) would slow down the loading performance significantly though.

If you're a programmer then you can build the test app from this branch. Alternatively you can install the test version from an APK file here: https://github.com/michaeltroger/greenpass-android/actions/runs/8976793372/artifacts/1478226889 (it's a zip file that first needs to get extracted)

Please note that installing a test version (debug build) of the app, will make you loose all your app's data.

WOW, thank you so much for the super fast response and your enthusiasm 💕

Of course I would have been happy to help with troubleshooting/testing, but it seems that this is no longer necessary, because the debug build (mentioned above) solves the problem for me. So I can confirm that the PR #252 works for my current D-Ticket and just have to say thank you so much for all of your efforts (and your great app, by the way)!

revuwa commented 1 week ago

PS: the enlarged barcode (within your debug build) could be read without any problems during a passenger check, today.

If increasing the value of PDF_RESOLUTION_MULTIPLIER has the downside of slower performance, what do you think about an option for this? As long as it doesn't make things too complex, unnecessarily?

I would think about something like this: image (This is just an edited image for illustrative purposes, I don't have coded anythin').

michaeltroger commented 1 week ago

Thanks for trying it out right away! Glad to hear that the fix works.

Yes, I thought about the same. A setting is definitely an option. I would not want to ship the change as it is just yet though. I still want to check if there is some optimization possible. Also there is a bit a weird loading state when fastly scrolling through PDFs with many pages. That bug is not directly related to the one here, but it becomes more noticeable with the longer loading time.

I'm busy these days but I'm definitely planning to ship this fix in the upcoming days/weeks in some way!