From b49af817e2cdc21ec8540f807c6db96bc4d5248f Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Thu, 10 Jun 2021 16:05:11 +0300 Subject: [PATCH] [all mobile] emulate default device when it's not a compatible --- apps/documenteditor/mobile/src/index_dev.html | 12 ++++++++++++ apps/presentationeditor/mobile/src/index_dev.html | 12 ++++++++++++ apps/spreadsheeteditor/mobile/src/index_dev.html | 12 ++++++++++++ 3 files changed, 36 insertions(+) diff --git a/apps/documenteditor/mobile/src/index_dev.html b/apps/documenteditor/mobile/src/index_dev.html index e6206d4cb..34e64efc6 100644 --- a/apps/documenteditor/mobile/src/index_dev.html +++ b/apps/documenteditor/mobile/src/index_dev.html @@ -33,6 +33,18 @@ // Framework7 doesn't set Device.android flag when navigator.platform == 'Win32', change it for debug navigator.__defineGetter__('platform', () => 'Win32Debug'); + if ( !isAndroid ) { + const ua = navigator.userAgent; + const iPad = ua.match(/(iPad).*OS\s([\d_]+)/); + const iPhone = !iPad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/); + + if ( !iPad && !iPhone ) { + Object.defineProperty(navigator, 'userAgent', { + get: function () { return `iPad; CPU OS 11_0 ${ua}`; } + }); + } + } + const getUrlParams = () => { let e, a = /\+/g, // Regex for replacing addition symbol with a space diff --git a/apps/presentationeditor/mobile/src/index_dev.html b/apps/presentationeditor/mobile/src/index_dev.html index 4342a52b6..cb2743791 100644 --- a/apps/presentationeditor/mobile/src/index_dev.html +++ b/apps/presentationeditor/mobile/src/index_dev.html @@ -33,6 +33,18 @@ // Framework7 doesn't set Device.android flag when navigator.platform == 'Win32', change it for debug navigator.__defineGetter__('platform', () => 'Win32Debug'); + if ( !isAndroid ) { + const ua = navigator.userAgent; + const iPad = ua.match(/(iPad).*OS\s([\d_]+)/); + const iPhone = !iPad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/); + + if ( !iPad && !iPhone ) { + Object.defineProperty(navigator, 'userAgent', { + get: function () { return `iPad; CPU OS 11_0 ${ua}`; } + }); + } + } + const getUrlParams = () => { let e, a = /\+/g, // Regex for replacing addition symbol with a space diff --git a/apps/spreadsheeteditor/mobile/src/index_dev.html b/apps/spreadsheeteditor/mobile/src/index_dev.html index 8b053439c..4494d3717 100644 --- a/apps/spreadsheeteditor/mobile/src/index_dev.html +++ b/apps/spreadsheeteditor/mobile/src/index_dev.html @@ -33,6 +33,18 @@ // Framework7 doesn't set Device.android flag when navigator.platform == 'Win32', change it for debug navigator.__defineGetter__('platform', () => 'Win32Debug'); + if ( !isAndroid ) { + const ua = navigator.userAgent; + const iPad = ua.match(/(iPad).*OS\s([\d_]+)/); + const iPhone = !iPad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/); + + if ( !iPad && !iPhone ) { + Object.defineProperty(navigator, 'userAgent', { + get: function () { return `iPad; CPU OS 11_0 ${ua}`; } + }); + } + } + const getUrlParams = () => { let e, a = /\+/g, // Regex for replacing addition symbol with a space