Skip to content

Commit 857754e

Browse files
authored
fix: correct device detection error on mobile (#143)
System detection (phone) depends on platform and touch support, both not calculated, causing a JS error.
1 parent 9e44a66 commit 857754e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/core/overlay/sap/ui/Device.js

+11
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ const _getOS = () => {
165165
}
166166

167167
const _setOS = () => {
168+
if (Device.os) {
169+
return;
170+
}
171+
168172
Device.os = _getOS() || {};
169173
Device.os.OS = OS;
170174
Device.os.version = Device.os.versionStr ? parseFloat(Device.os.versionStr) : -1;
@@ -592,6 +596,10 @@ const isSafari = () => {
592596
//******** Support Detection ********
593597

594598
const _setSupport = () => {
599+
if (Device.support) {
600+
return;
601+
}
602+
595603
if (!Device.browser) {
596604
setBrowser();
597605
}
@@ -751,6 +759,9 @@ const _getSystem = () => {
751759
}
752760

753761
const _setSystem = () => {
762+
_setSupport();
763+
_setOS();
764+
754765
Device.system = {};
755766
Device.system = _getSystem();
756767
if (Device.system.tablet || Device.system.phone) {

0 commit comments

Comments
 (0)