Friday, September 3, 2021
1 change · master
Enhancements to existing features
Barcode scanning is updated to use standard browser camera and barcode detection capabilities instead of relying mainly on native mobile app functions. This makes the experience more consistent across supported devices, while also moving small-screen web behavior into the enterprise web module and using Odoo notifications and device vibration where available.
Original PR description
This PR aims at replacing as much mobile app's native APIs (cf. `mobile.methods`) by their equivalent Web APIs. More specifically, it targets the barcode scanning feature by using the device's camera…
This PR aims at replacing as much mobile app's native APIs (cf. `mobile.methods`) by their equivalent Web APIs. More specifically, it targets the barcode scanning feature by using the device's camera through `getUserMedia`and Shape Detection API (or a lightweight polyfill, depending on the browser support). In this process, some other methods like `vibrate` or `showToast` are also replaced by, respectively, their Web equivalent or the Odoo notification system. Finally, this PR is the opportunity to refocus the `web_mobile` module's content to its primary purpose: provide support for the native mobile apps (leaving the responsive part to `web_enterprise`). Note: this feature requires a secureContext (aka. HTTPS) to be available. References: - https://developer.mozilla.org/en-US/docs/Web/API/BarcodeDetector - https://github.com/zxing-js/library - https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia Task ID: 2583914 Co-authored-by: Romeo Fragomeli <rfr@odoo.com> Co-authored-by: Pierre Paridans <app@odoo.com>