Browse Source

Small changes

customisations
alemart 1 year ago
parent
commit
7eb524d5ea
1 changed files with 9 additions and 5 deletions
  1. 9
    5
      src/utils/utils.ts

+ 9
- 5
src/utils/utils.ts View File

@@ -20,9 +20,10 @@
20 20
  * Generic utilities
21 21
  */
22 22
 
23
+import Speedy from 'speedy-vision';
24
+import { SpeedySize } from 'speedy-vision/types/core/speedy-size';
23 25
 import { AssertionError, IllegalArgumentError } from './errors';
24 26
 import { Resolution, computeResolution } from '../core/resolution';
25
-import { SpeedySize } from 'speedy-vision/types/core/speedy-size';
26 27
 
27 28
 /**
28 29
  * Nullable type
@@ -119,12 +120,15 @@ export class Utils
119 120
      */
120 121
     static isIOS(): boolean
121 122
     {
122
-        const platform = Utils.platformString();
123
+        // at the time of this writing, navigator.userAgentData is not yet
124
+        // compatible with Safari. navigator.platform is deprecated, but
125
+        // predictable.
123 126
 
124
-        if(/(iOS|iPhone|iPad|iPod)/i.test(platform))
127
+        //if(/(iOS|iPhone|iPad|iPod)/i.test(Utils.platformString()))
128
+        if(/(iOS|iPhone|iPad|iPod)/i.test(navigator.platform))
125 129
             return true;
126 130
 
127
-        if(/Mac/i.test(platform) && navigator.maxTouchPoints !== undefined) // iPad OS 13+
131
+        if(/Mac/i.test(navigator.platform) && navigator.maxTouchPoints !== undefined) // iPad OS 13+
128 132
             return navigator.maxTouchPoints > 2;
129 133
 
130 134
         return false;
@@ -137,7 +141,7 @@ export class Utils
137 141
     static isWebKit(): boolean
138 142
     {
139 143
         // note: navigator.vendor is deprecated.
140
-        // Alternatively, test GL_RENDERER == "Apple GPU"
144
+        // Alternatively, test GL_RENDERER == "Apple GPU" (valid since Feb 2020)
141 145
         if(/Apple/.test(navigator.vendor))
142 146
             return true;
143 147
 

Loading…
Cancel
Save