Skip to content

Commit

Permalink
fix: correct device detection error on mobile (#143)
Browse files Browse the repository at this point in the history
System detection (phone) depends on platform and touch support,
both not calculated, causing a JS error.
  • Loading branch information
ilhan007 authored Mar 7, 2019
1 parent 9e44a66 commit 857754e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/core/overlay/sap/ui/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ const _getOS = () => {
}

const _setOS = () => {
if (Device.os) {
return;
}

Device.os = _getOS() || {};
Device.os.OS = OS;
Device.os.version = Device.os.versionStr ? parseFloat(Device.os.versionStr) : -1;
Expand Down Expand Up @@ -592,6 +596,10 @@ const isSafari = () => {
//******** Support Detection ********

const _setSupport = () => {
if (Device.support) {
return;
}

if (!Device.browser) {
setBrowser();
}
Expand Down Expand Up @@ -751,6 +759,9 @@ const _getSystem = () => {
}

const _setSystem = () => {
_setSupport();
_setOS();

Device.system = {};
Device.system = _getSystem();
if (Device.system.tablet || Device.system.phone) {
Expand Down

0 comments on commit 857754e

Please sign in to comment.