diff --git a/addons/web/static/src/js/services/config.js b/addons/web/static/src/js/services/config.js index 6c576c351bb..dde878f102d 100644 --- a/addons/web/static/src/js/services/config.js +++ b/addons/web/static/src/js/services/config.js @@ -14,6 +14,11 @@ const bus = new Bus(); * this file someday. */ +const maxTouchPoints = navigator.maxTouchPoints || 1; +const isAndroid = /Android/i.test(navigator.userAgent); +const isIOS = /(iPad|iPhone|iPod)/i.test(navigator.userAgent) || (navigator.platform === 'MacIntel' && maxTouchPoints > 1); +const isOtherMobileDevice = /(webOS|BlackBerry|Windows Phone)/i.test(navigator.userAgent); + var config = { device: { /** @@ -52,13 +57,7 @@ var config = { * * @return {boolean} */ - isMobileDevice: navigator.userAgent.match(/Android/i) || - navigator.userAgent.match(/webOS/i) || - navigator.userAgent.match(/iPhone/i) || - navigator.userAgent.match(/iPad/i) || - navigator.userAgent.match(/iPod/i) || - navigator.userAgent.match(/BlackBerry/i) || - navigator.userAgent.match(/Windows Phone/i), + isMobileDevice: isAndroid || isIOS || isOtherMobileDevice, /** * Mapping between the numbers 0,1,2,3,4,5,6 and some descriptions */