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

Rework barcode detection logic #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alekslario
Copy link

@alekslario alekslario commented Jun 5, 2019

Rewritten onDetected method. Fetching on every single detect is not needed since there will be false detections.
Rewritten and moved conditional logic into onDetected. Now instead of attempts (which is not very useful since 4th attempt might be a false one) detected barcodes are saved in the component state detected: { 33634646346:[numberOfDetections] }. Before fetching now a barcode has to be detected 3 times. Happens instantly from my experience.

Removed status condition if (status === 1) before
calling this.onProductFound(code). A person needs to be informed if a barcode is not in openfoodfacts database. With if (status === 1) this sad fact is not reported and the app keeps scanning forever.
Finally removed onInfoFetched since with all above changes there is no need in this method.

@moigonzalez
Copy link
Owner

Wow this is super neat! Will test it in the staging url and merge it if everything goes well 😄

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

Successfully merging this pull request may close these issues.

2 participants