Shopify / shopify-app-bridge

https://shopify.dev/docs/api/app-bridge
85 stars 9 forks source link

Breaking change to scanner functionality #181

Closed charles-tyler closed 1 year ago

charles-tyler commented 1 year ago

Describe the bug

We are still facing an issue with the POS scanner that it is not returning the barcode value as expected.

Plus a new issue seems to have arisen with the App Bridge scanner mid-last week (seems to be in line with version 9.99.0).

When scanning a UPC-A barcode with 12 characters the Scanner feature seems to convert this to an EAN13 barcode (adding an extra leading character) - but only for the App bridge version of the scanner (?!). It doesn’t add this for the scanner accessed within Shopify Mobile POS or Shopify Mobile app for Shopify functions.

This is a breaking change and is costing users time because the value received from the App bridge scanner is different from what it was previously.

Please contact me for videos highlighting this issue. An example UPC-A barcode for reference. example product barcode

074261041218

To Reproduce

  1. Launch Shopify mobile app
  2. Click "Products"
  3. Select a product
  4. Select a variant
  5. Click "More" next to Inventory
  6. Click the barcode symbol next to "Barcode (ISBN, UPC, etc.)"
  7. Scan UPC-A barcode
  8. Value returned is as expected 074261041218

Bug

  1. Open an app using the App Bridge scanner
  2. Scan the same barcode above
  3. Value returned is 0074261041218 (extra leading zero)

Expected behaviour

The returned value should be what the barcode represents! There shouldn't be extra characters introduced.

Contextual information

Packages and versions

Platform

Additional context

Happy to share videos of the process - let me know!

ashchristopher commented 1 year ago

This could be a problem with how iOS and Android treat barcode scanning differently. We saw similar behavior on the POS barcode scanner (not AppBridge). Android will return the actual numbers, where as iOS will pad with leading zeros. This was at the OS level.

I believe @andrewmc2shopify had to introduce some hacks to work around the problem.

cc: @avaz-shopify

avaz-shopify commented 1 year ago

This could be a problem with how iOS and Android treat barcode scanning differently. We saw similar behavior on the POS barcode scanner (not AppBridge). Android will return the actual numbers, where as iOS will pad with leading zeros. This was at the OS level.

I believe @andrewmc2shopify had to introduce some hacks to work around the problem.

cc: @avaz-shopify

It looks like the AppBridgeScannerScreen component is taking the string directly scanned by the expo barcode scanner and passing it back through the callback.

Unfortunately the expo barcode scanning library treats EAN13 and UPC-A barcodes differently for iOS and Android. Because of this, we have added logic to handle the discrepancies in our internal scanner screen to "sanitize" the string coming back from the scanner so that we can accurately search and return the correct product.

The AppBridgeScannerScreen should implement similar logic so that we ensure the correct information gets sent to the user of the scanner component.

charles-tyler commented 1 year ago

@avaz-shopify Please could you let me know when this is going to be implemented?

We have users that are not able to use the scanner and were using it in their work flow previously.

At the very least please can we learn about the logic you are referring to? Then we can add it as well.

avaz-shopify commented 1 year ago

@avaz-shopify Please could you let me know when this is going to be implemented?

We have users that are not able to use the scanner and were using it in their work flow previously.

At the very least please can we learn about the logic you are referring to? Then we can add it as well.

The retail-succeed-build team that works on these extensions has taken this issue over. @heltisace, do you have any updates on this issue?

heltisace commented 1 year ago

@charles-tyler the internal PR is up and is being reviewed. For now, we are discussing whether or not this warrants a cherry-picked release or if we should wait until the next scheduled cutoff.

heltisace commented 1 year ago

The fix was merged. The QA will start reviewing next week, and hopefully the changes will be included in POS 8.5 which should start rolling out on March 20th.

charles-tyler commented 1 year ago

Thanks @heltisace fixed for POS Bug is still present on iOS Shopify Mobile app. Returning different data from the scanner for the Shopify app compared with embedded apps. Extra leading zero is returned for the barcode above and other UPC-A barcodes. Happy to share more info if required - ping me on the partners slack. Also seems to be a bug that the scanner stops working when switching stores on the Shopify mobile app. Current app version v9.103.0

charles-tyler commented 1 year ago

Please can we add a label for Shopify Mobile to this issue?

ychahdoura commented 1 year ago

@charles-tyler, the fix was merged and the update will be available on the next rollout