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

[WC-2405]: Add barcode format controls to prevent incorrect scanning #980

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

HedwigAR
Copy link
Contributor

@HedwigAR HedwigAR commented Apr 8, 2024

Pull request type

Bug fix (non-breaking change which fixes an issue)


Description

We found a case where a Code-39 code was recognized as a RSS-14 code instead. Since we support both of them and they do look very similar, we've added an option to be able to specify what formats should be recognized.
Now the user can select if they want to be able to recognize all formats (this is the option that's enabled by default). If the user does not want this, they'll be able to specify only the codes they're expecting.
This PR also includes a fix for scanning with the mask enabled, where it wasn't scanning the full resolution.

What should be covered while testing?

Testing should check whether it's still possible to recognize all barcode types when useAllFormats is set to Yes. Test should also check whether selecting specific formats is effective, and if this does exclude other codes from being recognized (aka, when only code-39 is selected it should no longer trigger on QR codes)

@HedwigAR HedwigAR requested a review from a team as a code owner April 8, 2024 12:17
@iobuhov iobuhov added this to the barcode-scanner-web-v2.4.0 milestone Apr 8, 2024
@iobuhov
Copy link
Collaborator

iobuhov commented Apr 8, 2024

Great PR and description BTW 👍

@HedwigAR HedwigAR force-pushed the fix/WC-2405-phone-web-barcode-scanner-code-39-value branch from d14c907 to 7c0feeb Compare April 8, 2024 14:03
iobuhov
iobuhov previously approved these changes Apr 9, 2024
@HedwigAR HedwigAR force-pushed the fix/WC-2405-phone-web-barcode-scanner-code-39-value branch from 20c1947 to 857df22 Compare May 15, 2024 09:24
const scanWithCropOnce = (reader: BrowserMultiFormatReader): Promise<Result> => {
const cropWidth = videoRef.current!.videoWidth * scale;
const element = document.getElementById("canvas-middle-middle")!;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we should use refs? It's more react way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I fixed it and used a ref instead, let me know if I did that right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants