openfoodfacts / smooth-app

🤳🥫 The new Open Food Facts mobile application for Android and iOS, crafted with Flutter and Dart
https://world.openfoodfacts.org/open-food-facts-mobile-app?utm_source=off&utf_medium=web&utm_campaign=github-repo
Apache License 2.0
837 stars 279 forks source link

(Product addition) Trying to scan non standard barcodes has a disappointing experience #1427

Closed teolemon closed 2 years ago

teolemon commented 2 years ago

What

Steps to reproduce the behavior

  1. Scan the Open Food Facts logo
  2. Click on 'Add product'
  3. See error

Expected behavior

It should either

Part of

Screenshot/Mockup/Before-After

image image

g123k commented 2 years ago

With #1781, these formats are only accepted now:

      BarcodeFormat.ean8,
      BarcodeFormat.ean13,
      BarcodeFormat.upca,
      BarcodeFormat.upce,
      BarcodeFormat.code39,
      BarcodeFormat.code93,
      BarcodeFormat.code128,
      BarcodeFormat.itf,
      BarcodeFormat.codabar,

Is-it still an issue?

cli1005 commented 2 years ago

Since Server calls a function normalize_code to verify whether the barcode is valid in the beginning of almost all operations, including searching and uploading.

If the scanned barcode is invalid, the code in FetchedStatus will be empty as follows: {status: 0, code: , status_verbose: no code or invalid code, product: null}

In this case a little message will show like this to avoid wasting time in creating and uploading : Image

Please let me know if it is not OK for you, thanks