Переглянути джерело

Small changes

customisations
alemart 1 рік тому
джерело
коміт
7eb524d5ea
1 змінених файлів з 9 додано та 5 видалено
  1. 9
    5
      src/utils/utils.ts

+ 9
- 5
src/utils/utils.ts Переглянути файл

20
  * Generic utilities
20
  * Generic utilities
21
  */
21
  */
22
 
22
 
23
+import Speedy from 'speedy-vision';
24
+import { SpeedySize } from 'speedy-vision/types/core/speedy-size';
23
 import { AssertionError, IllegalArgumentError } from './errors';
25
 import { AssertionError, IllegalArgumentError } from './errors';
24
 import { Resolution, computeResolution } from '../core/resolution';
26
 import { Resolution, computeResolution } from '../core/resolution';
25
-import { SpeedySize } from 'speedy-vision/types/core/speedy-size';
26
 
27
 
27
 /**
28
 /**
28
  * Nullable type
29
  * Nullable type
119
      */
120
      */
120
     static isIOS(): boolean
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
             return true;
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
             return navigator.maxTouchPoints > 2;
132
             return navigator.maxTouchPoints > 2;
129
 
133
 
130
         return false;
134
         return false;
137
     static isWebKit(): boolean
141
     static isWebKit(): boolean
138
     {
142
     {
139
         // note: navigator.vendor is deprecated.
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
         if(/Apple/.test(navigator.vendor))
145
         if(/Apple/.test(navigator.vendor))
142
             return true;
146
             return true;
143
 
147
 

Завантаження…
Відмінити
Зберегти