|
@@ -188,6 +188,33 @@ export class Session extends AREventTarget<SessionEventType>
|
188
|
188
|
*/
|
189
|
189
|
static isSupported(): boolean
|
190
|
190
|
{
|
|
191
|
+ // navigator.platform is deprecated
|
|
192
|
+ const platform = ((navigator: any): string =>
|
|
193
|
+ typeof navigator.userAgentData === 'object' ?
|
|
194
|
+ navigator.userAgentData.platform :
|
|
195
|
+ navigator.platform
|
|
196
|
+ )(navigator);
|
|
197
|
+
|
|
198
|
+ // If Safari or iOS, require version 15.2 or later
|
|
199
|
+ if(/(Mac|iOS|iPhone|iPad|iPod)/i.test(platform)) {
|
|
200
|
+ const ios = /(iPhone|iPad|iPod).* (CPU[\s\w]* OS|CPU iPhone|iOS) ([\d\._]+)/.exec(navigator.userAgent); // Chrome, Firefox, Edge, Safari on iOS
|
|
201
|
+ const safari = /(AppleWebKit)\/.* (Version)\/([\d\.]+)/.exec(navigator.userAgent); // Safari on macOS (also newer iPads, Edge on iOS...)
|
|
202
|
+ const matches = safari || ios; // match safari first (min version)
|
|
203
|
+
|
|
204
|
+ if(matches !== null) {
|
|
205
|
+ const version = matches[3] || '0.0';
|
|
206
|
+ const [x, y] = version.split(/[\._]/).map(v => parseInt(v));
|
|
207
|
+
|
|
208
|
+ if((x < 15) || (x == 15 && y < 2)) {
|
|
209
|
+ Utils.warning(`${matches === safari ? 'Safari' : 'iOS'} version ${version} is not supported! User agent: ${navigator.userAgent}`);
|
|
210
|
+ return false;
|
|
211
|
+ }
|
|
212
|
+ }
|
|
213
|
+ else
|
|
214
|
+ Utils.warning(`Unrecognized user agent: ${navigator.userAgent}`);
|
|
215
|
+ }
|
|
216
|
+
|
|
217
|
+ // Check if WebGL2 and WebAssembly are supported
|
191
|
218
|
return Speedy.isSupported();
|
192
|
219
|
}
|
193
|
220
|
|