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

feat: Snackbar "Not a valid product barcode" when we scan a QR-Code #840 #1739

Closed

Conversation

mse-moises
Copy link
Contributor

What

The objective was to prevent the user from reading a QRCode. So, if the user reads a QRCode a snackbar with "Not a valid product barcode" should appear.

  • Create a list of invalid format to both readers, the MlKit and the QrCodeScanner
  • Create validations methods to both readers and use them accordingly
  • Create a method to show the "Not a valid product barcode" snackbar with a guard clause mechanism to prevent a endless stack of snackbar

Screenshot

qemu-system-x86_64_eBSkfY9vh9.mp4

Part of

@mse-moises mse-moises requested a review from a team as a code owner May 4, 2022 19:16
@mse-moises mse-moises changed the title Snackbar "Not a valid product barcode" when we scan a QR-Code #840 feat: Snackbar "Not a valid product barcode" when we scan a QR-Code #840 May 4, 2022
@teolemon teolemon added this to the V1 milestone May 5, 2022
@g123k
Copy link
Collaborator

g123k commented May 5, 2022

There is an easiest way to achieve what you want.
Just ask for EAN8 or 13 barcodes.

Also implemented in my upcoming PR https://github.com/openfoodfacts/smooth-app/pull/1750/files#diff-21b1fd43eef0f641c2d4ac4ff84a6ae0117b3266b07f8694bb28d7fff4345f38R155

@mse-moises
Copy link
Contributor Author

I actually thought about doing it, but I was worried if this implementation would prevent someone from registering a product with like a UPCA or UPCE barcode. So I just tried to stick strictly to what the titles of the issues ask for and 'ban' some types of barcode.

@teolemon teolemon added 🤳🥫 Scan We need to be able to scan on low-end, old devices, even with a bad camera, connexion… and removed scanning labels May 8, 2022
@teolemon
Copy link
Member

I'm going to close this because of new drastic changes by @g123k
It won't do a thing anymore with QRCodes, and there's no event to show the snackbar anymore

@teolemon teolemon closed this May 19, 2022
@M123-dev
Copy link
Member

Nevertheless thanks @mse-moises

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge conflicts 🤳🥫 Scan We need to be able to scan on low-end, old devices, even with a bad camera, connexion…
Development

Successfully merging this pull request may close these issues.

The scanner should display a snackbar "Not a valid product barcode" when we scan a QR-Code
4 participants