Skip to content

Rework barcode detection logic#8

Open
alekslario wants to merge 1 commit intomoigonzalez:masterfrom
alekslario:master
Open

Rework barcode detection logic#8
alekslario wants to merge 1 commit intomoigonzalez:masterfrom
alekslario:master

Conversation

@alekslario
Copy link
Copy Markdown

@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
Copy Markdown
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