native-fn 1.0.73 → 1.0.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -5
- package/dist/native.cjs +1 -1
- package/dist/native.min.cjs +1 -1
- package/dist/native.min.mjs +1 -1
- package/dist/native.mjs +1 -1
- package/dist/native.umd.js +1 -1
- package/dist/native.umd.min.js +1 -1
- package/dist/plugin/app/index.cjs +357 -178
- package/dist/plugin/app/index.min.cjs +1 -1
- package/dist/plugin/app/index.min.mjs +1 -1
- package/dist/plugin/app/index.mjs +357 -178
- package/dist/plugin/app/index.umd.js +357 -178
- package/dist/plugin/app/index.umd.min.js +1 -1
- package/dist/plugin/app/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/app/src/plugin/platform/cores/index.d.ts +12 -0
- package/dist/plugin/app/src/plugin/platform/types/platform.d.ts +16 -6
- package/dist/plugin/app/src/types/native.d.ts +5 -5
- package/dist/plugin/appearance/index.cjs +346 -167
- package/dist/plugin/appearance/index.min.cjs +1 -1
- package/dist/plugin/appearance/index.min.mjs +1 -1
- package/dist/plugin/appearance/index.mjs +346 -167
- package/dist/plugin/appearance/index.umd.js +346 -167
- package/dist/plugin/appearance/index.umd.min.js +1 -1
- package/dist/plugin/appearance/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/appearance/src/plugin/platform/cores/index.d.ts +12 -0
- package/dist/plugin/appearance/src/plugin/platform/types/platform.d.ts +16 -6
- package/dist/plugin/appearance/src/types/native.d.ts +5 -5
- package/dist/plugin/camera/index.cjs +2 -2
- package/dist/plugin/camera/index.min.cjs +1 -1
- package/dist/plugin/camera/index.min.mjs +1 -1
- package/dist/plugin/camera/index.mjs +2 -2
- package/dist/plugin/camera/index.umd.js +2 -2
- package/dist/plugin/camera/index.umd.min.js +1 -1
- package/dist/plugin/camera/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/clipboard/index.cjs +341 -162
- package/dist/plugin/clipboard/index.min.cjs +1 -1
- package/dist/plugin/clipboard/index.min.mjs +1 -1
- package/dist/plugin/clipboard/index.mjs +341 -162
- package/dist/plugin/clipboard/index.umd.js +341 -162
- package/dist/plugin/clipboard/index.umd.min.js +1 -1
- package/dist/plugin/clipboard/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/clipboard/src/plugin/platform/cores/index.d.ts +12 -0
- package/dist/plugin/clipboard/src/plugin/platform/types/platform.d.ts +16 -6
- package/dist/plugin/clipboard/src/types/native.d.ts +5 -5
- package/dist/plugin/fullscreen/index.cjs +350 -171
- package/dist/plugin/fullscreen/index.min.cjs +1 -1
- package/dist/plugin/fullscreen/index.min.mjs +1 -1
- package/dist/plugin/fullscreen/index.mjs +350 -171
- package/dist/plugin/fullscreen/index.umd.js +350 -171
- package/dist/plugin/fullscreen/index.umd.min.js +1 -1
- package/dist/plugin/fullscreen/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/fullscreen/src/plugin/platform/cores/index.d.ts +12 -0
- package/dist/plugin/fullscreen/src/plugin/platform/types/platform.d.ts +16 -6
- package/dist/plugin/fullscreen/src/types/native.d.ts +5 -5
- package/dist/plugin/platform/index.cjs +341 -162
- package/dist/plugin/platform/index.d.ts +18 -8
- package/dist/plugin/platform/index.min.cjs +1 -1
- package/dist/plugin/platform/index.min.mjs +1 -1
- package/dist/plugin/platform/index.mjs +341 -162
- package/dist/plugin/platform/index.umd.js +341 -162
- package/dist/plugin/platform/index.umd.min.js +1 -1
- package/dist/plugin/platform/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/platform/src/plugin/platform/cores/index.d.ts +12 -0
- package/dist/plugin/platform/src/plugin/platform/types/platform.d.ts +16 -6
- package/dist/plugin/platform/src/types/native.d.ts +5 -5
- package/dist/plugin/theme/index.cjs +341 -162
- package/dist/plugin/theme/index.min.cjs +1 -1
- package/dist/plugin/theme/index.min.mjs +1 -1
- package/dist/plugin/theme/index.mjs +341 -162
- package/dist/plugin/theme/index.umd.js +341 -162
- package/dist/plugin/theme/index.umd.min.js +1 -1
- package/dist/plugin/theme/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/theme/src/plugin/platform/cores/index.d.ts +12 -0
- package/dist/plugin/theme/src/plugin/platform/types/platform.d.ts +16 -6
- package/dist/plugin/theme/src/types/native.d.ts +5 -5
- package/dist/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/src/plugin/platform/cores/index.d.ts +12 -0
- package/dist/src/plugin/platform/types/platform.d.ts +16 -6
- package/dist/src/types/native.d.ts +5 -5
- package/package.json +1 -1
|
@@ -62,7 +62,7 @@ var Browsers;
|
|
|
62
62
|
})(Browsers || (Browsers = {}));
|
|
63
63
|
var CrossPlatformFramework;
|
|
64
64
|
(function (CrossPlatformFramework) {
|
|
65
|
-
CrossPlatformFramework["
|
|
65
|
+
CrossPlatformFramework["Unknown"] = "Unknown";
|
|
66
66
|
CrossPlatformFramework["ReactNative"] = "ReactNative";
|
|
67
67
|
CrossPlatformFramework["Electron"] = "Electron";
|
|
68
68
|
CrossPlatformFramework["Cordova"] = "Cordova";
|
|
@@ -70,21 +70,43 @@ var CrossPlatformFramework;
|
|
|
70
70
|
var USER_AGENT = typeof globalThis.navigator !== 'undefined' && typeof globalThis.navigator.userAgent === 'string' ? globalThis.navigator.userAgent : '';
|
|
71
71
|
|
|
72
72
|
var Platform = {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
crossPlatformFramework: CrossPlatformFramework.NotACrossPlatformFramework,
|
|
78
|
-
osVersion: '',
|
|
79
|
-
engineVersion: '',
|
|
80
|
-
browserVersion: '',
|
|
81
|
-
renderer: getRenderer(),
|
|
73
|
+
os: { name: OS.Unknown, version: '' },
|
|
74
|
+
engine: { name: Engines.Unknown, version: '' },
|
|
75
|
+
browser: { name: Browsers.Unknown, version: '' },
|
|
76
|
+
crossPlatformFramework: CrossPlatformFramework.Unknown,
|
|
82
77
|
userAgent: USER_AGENT,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
78
|
+
get network() {
|
|
79
|
+
return getNetwork();
|
|
80
|
+
},
|
|
81
|
+
get device() {
|
|
82
|
+
if (this.os.name === OS.iOS || this.os.name === OS.Android)
|
|
83
|
+
return Devices.Mobile;
|
|
84
|
+
if (this.os.name === OS.Windows || this.os.name === OS.MacOS)
|
|
85
|
+
return Devices.Desktop;
|
|
86
|
+
return Devices.Unknown;
|
|
87
|
+
},
|
|
88
|
+
get renderer() {
|
|
89
|
+
return getRenderer();
|
|
90
|
+
},
|
|
91
|
+
get isMobile() {
|
|
92
|
+
return this.device === Devices.Mobile;
|
|
93
|
+
},
|
|
94
|
+
get isDesktop() {
|
|
95
|
+
return this.device === Devices.Desktop;
|
|
96
|
+
},
|
|
97
|
+
get isWebview() {
|
|
98
|
+
return /; ?wv|applewebkit(?!.*safari)/i.test(this.userAgent);
|
|
99
|
+
},
|
|
100
|
+
get isNode() {
|
|
101
|
+
return typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.node !== undefined;
|
|
102
|
+
},
|
|
103
|
+
get isStandalone() {
|
|
104
|
+
if (this.os.name === OS.iOS)
|
|
105
|
+
return 'standalone' in globalThis.navigator && !!globalThis.navigator.standalone;
|
|
106
|
+
if (!('matchMedia' in globalThis))
|
|
107
|
+
return false;
|
|
108
|
+
return globalThis.matchMedia('(display-mode: standalone)').matches;
|
|
109
|
+
},
|
|
88
110
|
};
|
|
89
111
|
var OS_RESOLVER_MAP = [
|
|
90
112
|
[/windows nt (6\.[23]); arm/i, OS.Windows, resolveWindowsVersion],
|
|
@@ -144,6 +166,14 @@ var BROWSER_RESOLVER_MAP = [
|
|
|
144
166
|
[/mobile vr; rv:([\w.]+)\).+firefox/i, Browsers.Firefox],
|
|
145
167
|
[/firefox\/([\w.]+)/i, Browsers.Firefox],
|
|
146
168
|
];
|
|
169
|
+
var HIGH_ENTROPY_BRAND_NAME_MAP = {
|
|
170
|
+
'Google Chrome': 'Chrome',
|
|
171
|
+
'Microsoft Edge': 'Edge',
|
|
172
|
+
'Microsoft Edge WebView2': 'Edge WebView2',
|
|
173
|
+
'Android WebView': 'Chrome WebView',
|
|
174
|
+
'HeadlessChrome': 'Chrome Headless',
|
|
175
|
+
'OperaMobile': 'Opera Mobi',
|
|
176
|
+
};
|
|
147
177
|
function resolveWindowsVersion(string) {
|
|
148
178
|
if (string === undefined)
|
|
149
179
|
return '';
|
|
@@ -318,6 +348,33 @@ function normalizeBrand(entry) {
|
|
|
318
348
|
return { brand: entry, version: '' };
|
|
319
349
|
return { brand: entry.brand, version: entry.version };
|
|
320
350
|
}
|
|
351
|
+
function getSemanticVersion(string) {
|
|
352
|
+
var parts = string.split('.');
|
|
353
|
+
return {
|
|
354
|
+
major: parseInt(parts[0] || '0'),
|
|
355
|
+
minor: parseInt(parts[1] || '0'),
|
|
356
|
+
build: parseInt(parts[2] || '0')
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
function parseOSFromCordova() {
|
|
360
|
+
Platform.crossPlatformFramework = CrossPlatformFramework.Cordova;
|
|
361
|
+
if (typeof globalThis.device !== 'undefined') {
|
|
362
|
+
switch (globalThis.device.platform) {
|
|
363
|
+
case 'Android':
|
|
364
|
+
Platform.os = {
|
|
365
|
+
name: OS.Android,
|
|
366
|
+
version: globalThis.device.version,
|
|
367
|
+
};
|
|
368
|
+
break;
|
|
369
|
+
case 'iOS':
|
|
370
|
+
Platform.os = {
|
|
371
|
+
name: OS.iOS,
|
|
372
|
+
version: globalThis.device.version,
|
|
373
|
+
};
|
|
374
|
+
break;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
321
378
|
function getRenderer() {
|
|
322
379
|
if (typeof globalThis.document === 'undefined')
|
|
323
380
|
return '';
|
|
@@ -338,171 +395,293 @@ function getRenderer() {
|
|
|
338
395
|
return '';
|
|
339
396
|
}
|
|
340
397
|
}
|
|
341
|
-
function
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
var parts = string.split('.');
|
|
350
|
-
return {
|
|
351
|
-
major: parseInt(parts[0] || '0'),
|
|
352
|
-
minor: parseInt(parts[1] || '0'),
|
|
353
|
-
build: parseInt(parts[2] || '0')
|
|
398
|
+
function getNetwork() {
|
|
399
|
+
var network = {
|
|
400
|
+
isOnline: null,
|
|
401
|
+
effectiveType: null,
|
|
402
|
+
type: null,
|
|
403
|
+
downlink: null,
|
|
404
|
+
rtt: null,
|
|
405
|
+
saveData: null,
|
|
354
406
|
};
|
|
355
|
-
|
|
356
|
-
if (
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
if (typeof
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
break;
|
|
407
|
+
if (typeof globalThis.navigator !== 'undefined') {
|
|
408
|
+
if (typeof globalThis.navigator.onLine !== 'undefined')
|
|
409
|
+
network.isOnline = globalThis.navigator.onLine;
|
|
410
|
+
var connection = globalThis.navigator.connection || globalThis.navigator.mozConnection || globalThis.navigator.webkitConnection;
|
|
411
|
+
if (typeof connection !== 'undefined') {
|
|
412
|
+
if (typeof connection.effectiveType !== 'undefined')
|
|
413
|
+
network.effectiveType = connection.effectiveType;
|
|
414
|
+
if (typeof connection.type !== 'undefined')
|
|
415
|
+
network.type = connection.type;
|
|
416
|
+
if (typeof connection.downlink !== 'undefined')
|
|
417
|
+
network.downlink = connection.downlink;
|
|
418
|
+
if (typeof connection.rtt !== 'undefined')
|
|
419
|
+
network.rtt = connection.rtt;
|
|
420
|
+
if (typeof connection.saveData !== 'undefined')
|
|
421
|
+
network.saveData = connection.saveData;
|
|
422
|
+
}
|
|
372
423
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
424
|
+
if (Platform.isNode) {
|
|
425
|
+
try {
|
|
426
|
+
var os = require('os');
|
|
427
|
+
var networkInterfaces = os.networkInterfaces();
|
|
428
|
+
var networkInterfaceNames = Object.keys(networkInterfaces);
|
|
429
|
+
for (var i = 0; i < networkInterfaceNames.length; i++) {
|
|
430
|
+
var name_1 = networkInterfaceNames[i];
|
|
431
|
+
var networkInterface = networkInterfaces[name_1];
|
|
432
|
+
for (var j = 0; j < networkInterface.length; j++) {
|
|
433
|
+
var address = networkInterface[j];
|
|
434
|
+
if (!address.internal && address.family === 'IPv4')
|
|
435
|
+
network.isOnline = true;
|
|
436
|
+
}
|
|
437
|
+
if (network.isOnline)
|
|
438
|
+
break;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
catch (_) {
|
|
442
|
+
}
|
|
443
|
+
try {
|
|
444
|
+
var childProcess = require('child_process');
|
|
445
|
+
if (Platform.os.name === OS.Windows) {
|
|
446
|
+
try {
|
|
447
|
+
var output = childProcess.execSync('netsh wlan show interfaces', { encoding: 'utf8', timeout: 5000 });
|
|
448
|
+
if (output.includes('State') && output.includes('connected'))
|
|
449
|
+
network.type = 'wifi';
|
|
450
|
+
}
|
|
451
|
+
catch (_) {
|
|
452
|
+
}
|
|
453
|
+
if (network.type === null) {
|
|
454
|
+
try {
|
|
455
|
+
var output = childProcess.execSync('ipconfig', { encoding: 'utf8', timeout: 5000 });
|
|
456
|
+
if (output.includes('Ethernet adapter'))
|
|
457
|
+
network.type = 'ethernet';
|
|
458
|
+
}
|
|
459
|
+
catch (_) {
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
if (network.type === null)
|
|
463
|
+
network.type = 'other';
|
|
464
|
+
}
|
|
465
|
+
else if (Platform.os.name === OS.MacOS) {
|
|
466
|
+
try {
|
|
467
|
+
var output = childProcess.execSync('networksetup -listallhardwareports', { encoding: 'utf8', timeout: 5000 });
|
|
468
|
+
var activeInterface = childProcess.execSync('route -n get default | grep interface', { encoding: 'utf8', timeout: 5000 });
|
|
469
|
+
if (activeInterface.includes('en0') && output.includes('Wi-Fi'))
|
|
470
|
+
network.type = 'wifi';
|
|
471
|
+
else if (activeInterface.includes('en') || output.includes('Ethernet'))
|
|
472
|
+
network.type = 'ethernet';
|
|
473
|
+
else
|
|
474
|
+
network.type = 'other';
|
|
475
|
+
}
|
|
476
|
+
catch (_) {
|
|
477
|
+
network.type = 'other';
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
catch (_) {
|
|
482
|
+
}
|
|
389
483
|
}
|
|
484
|
+
return network;
|
|
390
485
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
var regexp = map[0];
|
|
394
|
-
var browser = map[1];
|
|
395
|
-
var resolver = map[2];
|
|
396
|
-
var matched = Platform.userAgent.match(regexp);
|
|
397
|
-
if (matched !== null) {
|
|
398
|
-
Platform.browser = browser;
|
|
399
|
-
Platform.browserVersion = resolveVersion(matched[1], resolver);
|
|
400
|
-
break;
|
|
401
|
-
}
|
|
486
|
+
function canUseHighEntropyValues(navigator) {
|
|
487
|
+
return typeof globalThis.navigator !== 'undefined' && typeof navigator.userAgentData !== 'undefined' && typeof navigator.userAgentData.getHighEntropyValues !== 'undefined';
|
|
402
488
|
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
var
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
Platform.os = OS.Windows;
|
|
421
|
-
Platform.osVersion = resolveSemanticWindowsVersion(version, release);
|
|
422
|
-
break;
|
|
423
|
-
case 'macos':
|
|
424
|
-
Platform.os = OS.MacOS;
|
|
425
|
-
Platform.osVersion = release;
|
|
426
|
-
break;
|
|
489
|
+
function init() {
|
|
490
|
+
if ((typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.electron !== undefined) || (/ electron\//i.test(USER_AGENT)))
|
|
491
|
+
Platform.crossPlatformFramework = CrossPlatformFramework.Electron;
|
|
492
|
+
if (typeof globalThis.navigator !== 'undefined' && globalThis.navigator.product === 'ReactNative')
|
|
493
|
+
Platform.crossPlatformFramework = CrossPlatformFramework.ReactNative;
|
|
494
|
+
for (var i = 0; i < OS_RESOLVER_MAP.length; i++) {
|
|
495
|
+
var map = OS_RESOLVER_MAP[i];
|
|
496
|
+
var regexp = map[0];
|
|
497
|
+
var os = map[1];
|
|
498
|
+
var resolver = map[2];
|
|
499
|
+
var matched = Platform.userAgent.match(regexp);
|
|
500
|
+
if (matched !== null) {
|
|
501
|
+
Platform.os = {
|
|
502
|
+
name: os,
|
|
503
|
+
version: resolveVersion(matched[1], resolver),
|
|
504
|
+
};
|
|
505
|
+
break;
|
|
427
506
|
}
|
|
428
507
|
}
|
|
429
|
-
|
|
508
|
+
if (Platform.os.name === OS.iOS && compareVersion(Platform.os.version, '18.6') === 0) {
|
|
509
|
+
var version = /\) Version\/([\d.]+)/.exec(Platform.userAgent);
|
|
510
|
+
if (version !== null && parseInt(version[1].substring(0, 2), 10) >= 26)
|
|
511
|
+
Platform.os.version = version[1];
|
|
430
512
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
var
|
|
435
|
-
var
|
|
436
|
-
var
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
case 'darwin':
|
|
444
|
-
Platform.os = OS.MacOS;
|
|
445
|
-
Platform.osVersion = resolveSemanticDarwinVersion(version, release);
|
|
446
|
-
break;
|
|
447
|
-
case 'android':
|
|
448
|
-
Platform.os = OS.Android;
|
|
449
|
-
Platform.osVersion = release;
|
|
450
|
-
break;
|
|
451
|
-
case 'linux':
|
|
452
|
-
if (/android/i.test(release)) {
|
|
453
|
-
Platform.os = OS.Android;
|
|
454
|
-
Platform.osVersion = release;
|
|
455
|
-
}
|
|
456
|
-
break;
|
|
513
|
+
for (var i = 0; i < ENGINE_RESOLVER_MAP.length; i++) {
|
|
514
|
+
var map = ENGINE_RESOLVER_MAP[i];
|
|
515
|
+
var regexp = map[0];
|
|
516
|
+
var engine = map[1];
|
|
517
|
+
var resolver = map[2];
|
|
518
|
+
var matched = Platform.userAgent.match(regexp);
|
|
519
|
+
if (matched !== null) {
|
|
520
|
+
Platform.engine = {
|
|
521
|
+
name: engine,
|
|
522
|
+
version: resolveVersion(matched[1], resolver),
|
|
523
|
+
};
|
|
524
|
+
break;
|
|
457
525
|
}
|
|
458
526
|
}
|
|
459
|
-
|
|
527
|
+
for (var i = 0; i < BROWSER_RESOLVER_MAP.length; i++) {
|
|
528
|
+
var map = BROWSER_RESOLVER_MAP[i];
|
|
529
|
+
var regexp = map[0];
|
|
530
|
+
var browser = map[1];
|
|
531
|
+
var resolver = map[2];
|
|
532
|
+
var matched = Platform.userAgent.match(regexp);
|
|
533
|
+
if (matched !== null) {
|
|
534
|
+
Platform.browser = {
|
|
535
|
+
name: browser,
|
|
536
|
+
version: resolveVersion(matched[1], resolver),
|
|
537
|
+
};
|
|
538
|
+
break;
|
|
539
|
+
}
|
|
460
540
|
}
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
541
|
+
if (Platform.crossPlatformFramework === CrossPlatformFramework.ReactNative) {
|
|
542
|
+
try {
|
|
543
|
+
var reactNative = require('react-native');
|
|
544
|
+
var platform = reactNative.Platform;
|
|
545
|
+
var os = platform.OS;
|
|
546
|
+
var release = '' + platform.Version;
|
|
547
|
+
var version = getSemanticVersion(release);
|
|
548
|
+
switch (os) {
|
|
549
|
+
case 'android':
|
|
550
|
+
Platform.os = {
|
|
551
|
+
name: OS.Android,
|
|
552
|
+
version: resolveSemanticAndroidVersion(version, release),
|
|
553
|
+
};
|
|
554
|
+
break;
|
|
555
|
+
case 'ios':
|
|
556
|
+
Platform.os = {
|
|
557
|
+
name: OS.iOS,
|
|
558
|
+
version: release,
|
|
559
|
+
};
|
|
560
|
+
break;
|
|
561
|
+
case 'windows':
|
|
562
|
+
Platform.os = {
|
|
563
|
+
name: OS.Windows,
|
|
564
|
+
version: resolveSemanticWindowsVersion(version, release),
|
|
565
|
+
};
|
|
469
566
|
break;
|
|
470
|
-
case '
|
|
471
|
-
Platform.os =
|
|
567
|
+
case 'macos':
|
|
568
|
+
Platform.os = {
|
|
569
|
+
name: OS.MacOS,
|
|
570
|
+
version: release,
|
|
571
|
+
};
|
|
472
572
|
break;
|
|
473
573
|
}
|
|
474
|
-
Platform.osVersion = globalThis.device.version;
|
|
475
574
|
}
|
|
476
|
-
|
|
477
|
-
}
|
|
478
|
-
if (navigator.userAgentData !== undefined && navigator.userAgentData.getHighEntropyValues !== undefined) {
|
|
479
|
-
navigator
|
|
480
|
-
.userAgentData
|
|
481
|
-
.getHighEntropyValues(['brands', 'fullVersionList', 'mobile', 'model', 'platform', 'platformVersion', 'architecture', 'formFactors', 'bitness', 'uaFullVersion', 'wow64'])
|
|
482
|
-
.then(function (result) {
|
|
483
|
-
var brands = result.fullVersionList || result.brands || [];
|
|
484
|
-
var platformVersion = result.platformVersion;
|
|
485
|
-
for (var i = 0; i < brands.length; i++) {
|
|
486
|
-
var brand = normalizeBrand(brands[i]);
|
|
487
|
-
var brandName = brand.brand;
|
|
488
|
-
var brandVersion = brand.version;
|
|
489
|
-
if (/not.a.brand/i.test(brandName))
|
|
490
|
-
continue;
|
|
491
|
-
if (brandName === "Chromium")
|
|
492
|
-
Platform.engineVersion = brandVersion;
|
|
493
|
-
}
|
|
494
|
-
if (typeof platformVersion === 'string') {
|
|
495
|
-
if (Platform.os === OS.Windows && parseInt(platformVersion.replace(/[^\d.]/g, '').split('.')[0], 10) >= 13)
|
|
496
|
-
Platform.osVersion = '11';
|
|
497
|
-
else
|
|
498
|
-
Platform.osVersion = platformVersion;
|
|
575
|
+
catch (_) {
|
|
499
576
|
}
|
|
500
|
-
|
|
577
|
+
finally {
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
if (Platform.isNode) {
|
|
581
|
+
try {
|
|
582
|
+
var os = require('os');
|
|
583
|
+
var platform = os.platform();
|
|
584
|
+
var release = os.release();
|
|
585
|
+
var version = getSemanticVersion(release);
|
|
586
|
+
switch (platform) {
|
|
587
|
+
case 'win32':
|
|
588
|
+
Platform.os = {
|
|
589
|
+
name: OS.Windows,
|
|
590
|
+
version: resolveSemanticWindowsVersion(version, release),
|
|
591
|
+
};
|
|
592
|
+
break;
|
|
593
|
+
case 'darwin':
|
|
594
|
+
Platform.os = {
|
|
595
|
+
name: OS.MacOS,
|
|
596
|
+
version: resolveSemanticDarwinVersion(version, release),
|
|
597
|
+
};
|
|
598
|
+
break;
|
|
599
|
+
case 'android':
|
|
600
|
+
Platform.os = {
|
|
601
|
+
name: OS.Android,
|
|
602
|
+
version: release,
|
|
603
|
+
};
|
|
604
|
+
break;
|
|
605
|
+
case 'linux':
|
|
606
|
+
if (/android/i.test(release)) {
|
|
607
|
+
Platform.os = {
|
|
608
|
+
name: OS.Android,
|
|
609
|
+
version: release,
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
break;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
catch (_) {
|
|
616
|
+
}
|
|
617
|
+
finally {
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
if (typeof globalThis.document !== 'undefined') {
|
|
621
|
+
if (typeof globalThis.device !== 'undefined') {
|
|
622
|
+
parseOSFromCordova();
|
|
623
|
+
}
|
|
624
|
+
else {
|
|
625
|
+
globalThis.document.addEventListener("deviceready", parseOSFromCordova, false);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
if (canUseHighEntropyValues(globalThis.navigator)) {
|
|
629
|
+
globalThis
|
|
630
|
+
.navigator
|
|
631
|
+
.userAgentData
|
|
632
|
+
.getHighEntropyValues(['brands', 'fullVersionList', 'mobile', 'model', 'platform', 'platformVersion', 'architecture', 'formFactors', 'bitness', 'uaFullVersion', 'wow64'])
|
|
633
|
+
.then(function (result) {
|
|
634
|
+
var brands = result.fullVersionList || result.brands || [];
|
|
635
|
+
var platformVersion = result.platformVersion;
|
|
636
|
+
var platform = result.platform;
|
|
637
|
+
var browserName = Platform.browser.name;
|
|
638
|
+
var prevBrandName = null;
|
|
639
|
+
for (var i = 0; i < brands.length; i++) {
|
|
640
|
+
var brand = normalizeBrand(brands[i]);
|
|
641
|
+
var brandVersion = brand.version;
|
|
642
|
+
var brandName = brand.brand;
|
|
643
|
+
if (/not.a.brand/i.test(brandName))
|
|
644
|
+
continue;
|
|
645
|
+
if (prevBrandName === null || (/Chrom/.test(prevBrandName) && brandName !== 'Chromium') || (prevBrandName === 'Edge' && /WebView2/.test(brandName))) {
|
|
646
|
+
brandName = HIGH_ENTROPY_BRAND_NAME_MAP[brandName] || brandName;
|
|
647
|
+
prevBrandName = browserName;
|
|
648
|
+
if (prevBrandName === null || /Chrom/.test(prevBrandName) || !/Chrom/.test(brandName)) {
|
|
649
|
+
browserName = brandName;
|
|
650
|
+
if (browserName === 'Chrome' || browserName === 'Chrome WebView' || browserName === 'Chrome Headless')
|
|
651
|
+
Platform.browser.name = Browsers.Chrome;
|
|
652
|
+
else if (browserName === 'Edge' || browserName === 'Edge WebView2')
|
|
653
|
+
Platform.browser.name = Browsers.Edge;
|
|
654
|
+
else if (browserName === 'Opera Mobi')
|
|
655
|
+
Platform.browser.name = Browsers.Opera;
|
|
656
|
+
Platform.browser.version = brandVersion;
|
|
657
|
+
}
|
|
658
|
+
prevBrandName = brandName;
|
|
659
|
+
}
|
|
660
|
+
if (brandName === 'Chromium')
|
|
661
|
+
Platform.engine.version = brandVersion;
|
|
662
|
+
}
|
|
663
|
+
if (typeof platformVersion === 'string') {
|
|
664
|
+
if (Platform.os.name === OS.Windows)
|
|
665
|
+
Platform.os.version = parseInt(platformVersion.split('.')[0], 10) >= 13 ? '11' : '10';
|
|
666
|
+
else
|
|
667
|
+
Platform.os.version = platformVersion;
|
|
668
|
+
}
|
|
669
|
+
if (typeof platform === 'string') {
|
|
670
|
+
if (/android/i.test(platform))
|
|
671
|
+
Platform.os.name = OS.Android;
|
|
672
|
+
else if (/ios|iphone|ipad/i.test(platform))
|
|
673
|
+
Platform.os.name = OS.iOS;
|
|
674
|
+
else if (/windows|win32/i.test(platform))
|
|
675
|
+
Platform.os.name = OS.Windows;
|
|
676
|
+
else if (/macos|macintel/i.test(platform))
|
|
677
|
+
Platform.os.name = OS.MacOS;
|
|
678
|
+
}
|
|
679
|
+
if (result.mobile === true)
|
|
680
|
+
Platform.device = Devices.Mobile;
|
|
681
|
+
});
|
|
682
|
+
}
|
|
501
683
|
}
|
|
502
|
-
|
|
503
|
-
Platform.isMobile = Platform.device === Devices.Mobile;
|
|
504
|
-
Platform.isDesktop = Platform.device === Devices.Desktop;
|
|
505
|
-
Platform.isStandalone = getIsStandalone(Platform.os);
|
|
684
|
+
init();
|
|
506
685
|
|
|
507
686
|
var Fullscreen = {
|
|
508
687
|
get enabled() {
|
|
@@ -597,7 +776,7 @@ function getDefaultTarget() {
|
|
|
597
776
|
throw new Error();
|
|
598
777
|
return allWindows[0];
|
|
599
778
|
}
|
|
600
|
-
if (Platform.os === OS.iOS) {
|
|
779
|
+
if (Platform.os.name === OS.iOS) {
|
|
601
780
|
var video = globalThis.document.querySelector('video');
|
|
602
781
|
if (video === null)
|
|
603
782
|
throw new Error();
|
|
@@ -678,7 +857,7 @@ function bridgeEvents() {
|
|
|
678
857
|
if (typeof globalThis.document !== 'undefined')
|
|
679
858
|
globalThis.document.addEventListener(errorEvents[i], emitError, false);
|
|
680
859
|
}
|
|
681
|
-
if (
|
|
860
|
+
if (Platform.os.name === OS.iOS) {
|
|
682
861
|
bridgeIOSVideoEvents();
|
|
683
862
|
if (typeof globalThis.MutationObserver !== 'undefined') {
|
|
684
863
|
var observer = new MutationObserver(function () {
|
|
@@ -714,7 +893,7 @@ function getEnabled() {
|
|
|
714
893
|
}
|
|
715
894
|
}
|
|
716
895
|
if (api === null) {
|
|
717
|
-
if (
|
|
896
|
+
if (Platform.os.name !== OS.iOS)
|
|
718
897
|
return false;
|
|
719
898
|
var videos = globalThis.document.querySelectorAll('video');
|
|
720
899
|
for (var i = 0; i < videos.length; i++) {
|
|
@@ -738,7 +917,7 @@ function getElement() {
|
|
|
738
917
|
var allWindows = electron.BrowserWindow.getAllWindows();
|
|
739
918
|
for (var i = 0; i < allWindows.length; i++) {
|
|
740
919
|
var currentWindow = allWindows[i];
|
|
741
|
-
if (currentWindow.isFullScreen() || (Platform.os === OS.MacOS && typeof currentWindow.isSimpleFullScreen === 'function' && currentWindow.isSimpleFullScreen()))
|
|
920
|
+
if (currentWindow.isFullScreen() || (Platform.os.name === OS.MacOS && typeof currentWindow.isSimpleFullScreen === 'function' && currentWindow.isSimpleFullScreen()))
|
|
742
921
|
return currentWindow;
|
|
743
922
|
}
|
|
744
923
|
return null;
|
|
@@ -796,7 +975,7 @@ function request(target, options) {
|
|
|
796
975
|
resolve();
|
|
797
976
|
})
|
|
798
977
|
.catch(function () {
|
|
799
|
-
if (
|
|
978
|
+
if (Platform.os.name !== OS.iOS) {
|
|
800
979
|
reject();
|
|
801
980
|
return;
|
|
802
981
|
}
|
|
@@ -810,7 +989,7 @@ function request(target, options) {
|
|
|
810
989
|
}
|
|
811
990
|
}
|
|
812
991
|
catch (error) {
|
|
813
|
-
if (
|
|
992
|
+
if (Platform.os.name !== OS.iOS) {
|
|
814
993
|
reject();
|
|
815
994
|
return;
|
|
816
995
|
}
|
|
@@ -818,7 +997,7 @@ function request(target, options) {
|
|
|
818
997
|
}
|
|
819
998
|
}
|
|
820
999
|
function fallbackToIOSVideo() {
|
|
821
|
-
if (
|
|
1000
|
+
if (Platform.os.name === OS.iOS && target.tagName.toUpperCase() === 'VIDEO') {
|
|
822
1001
|
var video = target;
|
|
823
1002
|
if (video.webkitSupportsFullscreen && typeof video.webkitEnterFullscreen === 'function') {
|
|
824
1003
|
lastIOSVideo = video;
|
|
@@ -874,7 +1053,7 @@ function exit() {
|
|
|
874
1053
|
}
|
|
875
1054
|
}
|
|
876
1055
|
}
|
|
877
|
-
if (
|
|
1056
|
+
if (Platform.os.name === OS.iOS && lastIOSVideo !== null) {
|
|
878
1057
|
if (typeof lastIOSVideo.webkitExitFullscreen === 'function' && lastIOSVideo.webkitDisplayingFullscreen === true) {
|
|
879
1058
|
lastIOSVideo.webkitExitFullscreen();
|
|
880
1059
|
lastIOSVideo = null;
|