From fa2ea4683e198fc4565f2a0d9d5071c9428132f1 Mon Sep 17 00:00:00 2001 From: Adrien Dieudonne Date: Mon, 30 Apr 2018 12:30:03 +0200 Subject: [FIX] barcodes: Android Odoo app webview not detected as chrome Before this commit, it wasn't possible to use a barcode scanner with the Odoo mobile app. However it works fine for mobile Chrome browsers. We now know that 'keypress' event doesn't work as expected in Chrome for mobile. See @3a74afd21 It's why 'keydown' detection has been implemented. We also want to use this detection in our Android app. Unfortunately, 'window.chrome' doesn't seem to exist anymore in the Android webview. In this commit, we change the way Chrome is detected. --- addons/barcodes/static/src/js/barcode_events.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/barcodes/static/src') diff --git a/addons/barcodes/static/src/js/barcode_events.js b/addons/barcodes/static/src/js/barcode_events.js index 88ed3ce814c..a2e5808f8be 100644 --- a/addons/barcodes/static/src/js/barcode_events.js +++ b/addons/barcodes/static/src/js/barcode_events.js @@ -53,7 +53,7 @@ var BarcodeEvents = core.Class.extend(mixins.PropertiesMixin, { navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i); - this.isChromeMobile = isMobile && window.chrome; + this.isChromeMobile = isMobile && navigator.userAgent.match(/Chrome/i); // Creates an input who will receive the barcode scanner value. if (this.isChromeMobile) { -- cgit v1.2.3