native-fn 1.0.69 → 1.0.71

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.
Files changed (28) hide show
  1. package/dist/native.cjs +1 -1
  2. package/dist/native.min.cjs +1 -1
  3. package/dist/native.min.mjs +1 -1
  4. package/dist/native.mjs +1 -1
  5. package/dist/native.umd.js +1 -1
  6. package/dist/native.umd.min.js +1 -1
  7. package/dist/plugin/app/index.cjs +302 -310
  8. package/dist/plugin/app/index.min.cjs +1 -1
  9. package/dist/plugin/app/index.min.mjs +1 -1
  10. package/dist/plugin/app/index.mjs +302 -310
  11. package/dist/plugin/app/index.umd.js +302 -310
  12. package/dist/plugin/app/index.umd.min.js +1 -1
  13. package/dist/plugin/app/src/plugin/app/cores/index.d.ts +14 -0
  14. package/dist/plugin/app/src/plugin/appearance/constants/index.d.ts +1 -1
  15. package/dist/plugin/appearance/index.d.ts +0 -63
  16. package/dist/plugin/appearance/src/plugin/app/cores/index.d.ts +14 -0
  17. package/dist/plugin/appearance/src/plugin/appearance/constants/index.d.ts +1 -1
  18. package/dist/plugin/camera/src/plugin/app/cores/index.d.ts +14 -0
  19. package/dist/plugin/camera/src/plugin/appearance/constants/index.d.ts +1 -1
  20. package/dist/plugin/clipboard/src/plugin/app/cores/index.d.ts +14 -0
  21. package/dist/plugin/clipboard/src/plugin/appearance/constants/index.d.ts +1 -1
  22. package/dist/plugin/fullscreen/src/plugin/app/cores/index.d.ts +14 -0
  23. package/dist/plugin/fullscreen/src/plugin/appearance/constants/index.d.ts +1 -1
  24. package/dist/plugin/theme/src/plugin/app/cores/index.d.ts +14 -0
  25. package/dist/plugin/theme/src/plugin/appearance/constants/index.d.ts +1 -1
  26. package/dist/src/plugin/app/cores/index.d.ts +14 -0
  27. package/dist/src/plugin/appearance/constants/index.d.ts +1 -1
  28. package/package.json +1 -1
@@ -513,6 +513,169 @@
513
513
  Platform.isDesktop = Platform.device === Devices.Desktop;
514
514
  Platform.isStandalone = getIsStandalone(Platform.os);
515
515
 
516
+ function createCustomError(name, Base) {
517
+ if (Base === void 0) { Base = Error; }
518
+ function CustomError(message) {
519
+ if (!(this instanceof CustomError))
520
+ return new CustomError(message);
521
+ var error = new Base(message || '');
522
+ if (typeof Object.setPrototypeOf === 'function')
523
+ Object.setPrototypeOf(error, CustomError.prototype);
524
+ else
525
+ error.__proto__ = CustomError.prototype;
526
+ error.name = name;
527
+ if (message !== undefined)
528
+ error.message = message;
529
+ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
530
+ try {
531
+ Object.defineProperty(error, Symbol.toStringTag, {
532
+ value: name,
533
+ writable: false,
534
+ enumerable: false,
535
+ configurable: true
536
+ });
537
+ }
538
+ catch (_) {
539
+ }
540
+ }
541
+ if (typeof Error.captureStackTrace === 'function') {
542
+ Error.captureStackTrace(error, CustomError);
543
+ }
544
+ else if (Base.captureStackTrace && typeof Base.captureStackTrace === 'function') {
545
+ Base.captureStackTrace(error, CustomError);
546
+ }
547
+ else {
548
+ try {
549
+ var tempError = new Base();
550
+ if (tempError.stack)
551
+ error.stack = tempError.stack;
552
+ }
553
+ catch (_) {
554
+ }
555
+ }
556
+ return error;
557
+ }
558
+ CustomError.prototype = Object.create(Base.prototype, {
559
+ constructor: {
560
+ value: CustomError,
561
+ writable: true,
562
+ enumerable: false,
563
+ configurable: true
564
+ }
565
+ });
566
+ try {
567
+ Object.defineProperty(CustomError.prototype, 'name', {
568
+ value: name,
569
+ writable: true,
570
+ enumerable: false,
571
+ configurable: true
572
+ });
573
+ }
574
+ catch (_) {
575
+ try {
576
+ CustomError.prototype.name = name;
577
+ }
578
+ catch (_) {
579
+ }
580
+ }
581
+ try {
582
+ Object.defineProperty(CustomError, 'name', {
583
+ value: name,
584
+ writable: false,
585
+ enumerable: false,
586
+ configurable: true
587
+ });
588
+ }
589
+ catch (_) {
590
+ }
591
+ return CustomError;
592
+ }
593
+
594
+ var URLOpenError = createCustomError('URLOpenError');
595
+
596
+ function getTopmostWindow() {
597
+ try {
598
+ if (globalThis.top && globalThis.top !== window) {
599
+ void globalThis.top.location.href;
600
+ return globalThis.top;
601
+ }
602
+ }
603
+ catch (_) {
604
+ }
605
+ return window;
606
+ }
607
+
608
+ function createHiddenElement(tagName, focusable) {
609
+ if (focusable === void 0) { focusable = true; }
610
+ if (typeof globalThis.document === 'undefined')
611
+ return undefined;
612
+ var element = globalThis.document.createElement(tagName);
613
+ if ('width' in element)
614
+ element.width = '0';
615
+ if ('height' in element)
616
+ element.height = '0';
617
+ if ('border' in element)
618
+ element.border = '0';
619
+ if ('frameBorder' in element)
620
+ element.frameBorder = '0';
621
+ if ('scrolling' in element)
622
+ element.scrolling = 'no';
623
+ if ('cellPadding' in element)
624
+ element.cellPadding = '0';
625
+ if ('cellSpacing' in element)
626
+ element.cellSpacing = '0';
627
+ if ('frame' in element)
628
+ element.frame = 'void';
629
+ if ('rules' in element)
630
+ element.rules = 'none';
631
+ if ('noWrap' in element)
632
+ element.noWrap = true;
633
+ element.tabIndex = -1;
634
+ element.setAttribute('role', 'presentation');
635
+ if (focusable) {
636
+ element.style.width = '1px';
637
+ element.style.height = '1px';
638
+ }
639
+ else {
640
+ element.setAttribute('aria-hidden', 'true');
641
+ element.style.width = '0';
642
+ element.style.height = '0';
643
+ element.style.zIndex = '-9999';
644
+ element.style.display = 'none';
645
+ element.style.visibility = 'hidden';
646
+ element.style.pointerEvents = 'none';
647
+ }
648
+ element.style.position = 'absolute';
649
+ element.style.top = '0';
650
+ element.style.left = '0';
651
+ element.style.padding = '0';
652
+ element.style.margin = '0';
653
+ element.style.border = 'none';
654
+ element.style.outline = 'none';
655
+ element.style.clip = 'rect(1px, 1px, 1px, 1px)';
656
+ element.style.clipPath = 'inset(50%)';
657
+ element.style.overflow = 'hidden';
658
+ element.style.whiteSpace = 'nowrap';
659
+ return element;
660
+ }
661
+
662
+ function dispatchClickEvent(element, view) {
663
+ if (view === void 0) { view = window; }
664
+ var fake;
665
+ try {
666
+ fake = new MouseEvent('click', {
667
+ bubbles: true,
668
+ cancelable: true,
669
+ view: view
670
+ });
671
+ }
672
+ catch (_) {
673
+ fake = globalThis.document.createEvent('MouseEvents');
674
+ fake.initMouseEvent('click', true, true, view, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
675
+ }
676
+ element.dispatchEvent(fake);
677
+ }
678
+
516
679
  function capitalize(_) {
517
680
  var groups = [];
518
681
  for (var _i = 1; _i < arguments.length; _i++) {
@@ -657,89 +820,156 @@
657
820
  }
658
821
  };
659
822
 
660
- function getTopmostWindow() {
823
+ var _a;
824
+ var App = {
825
+ open: open,
826
+ messenger: (_a = {},
827
+ _a[MessengerType.Telephone] = openMessengerTelephone,
828
+ _a[MessengerType.Message] = openMessengerMessage,
829
+ _a[MessengerType.Mail] = openMessengerMail,
830
+ _a),
831
+ };
832
+ function getTrackId(bundle) {
661
833
  try {
662
- if (globalThis.top && globalThis.top !== window) {
663
- void globalThis.top.location.href;
664
- return globalThis.top;
834
+ var xhr = new XMLHttpRequest();
835
+ xhr.open('GET', 'https://itunes.apple.com/lookup?bundleId=' + bundle, false);
836
+ xhr.send();
837
+ if (xhr.status === 200) {
838
+ try {
839
+ var response = JSON.parse(xhr.response);
840
+ if (response.results === undefined)
841
+ return undefined;
842
+ var results = response.results;
843
+ if (!Array.isArray(results) || results.length === 0)
844
+ return undefined;
845
+ var result = results[0];
846
+ if (result === undefined)
847
+ return undefined;
848
+ return result.trackId;
849
+ }
850
+ catch (_) {
851
+ return undefined;
852
+ }
665
853
  }
854
+ return undefined;
666
855
  }
667
856
  catch (_) {
857
+ return undefined;
668
858
  }
669
- return window;
670
859
  }
671
-
672
- function dispatchClickEvent(element, view) {
673
- if (view === void 0) { view = window; }
674
- var fake;
675
- try {
676
- fake = new MouseEvent('click', {
677
- bubbles: true,
678
- cancelable: true,
679
- view: view
680
- });
860
+ function createIntentURL(scheme, packageName, fallback) {
861
+ var split = scheme.split('://');
862
+ var prefix = split[0];
863
+ var suffix = split[1];
864
+ var intent = 'intent://';
865
+ if (suffix !== undefined)
866
+ intent = intent + suffix;
867
+ intent = intent + '#Intent;'
868
+ + 'scheme=' + prefix + ';'
869
+ + 'action=android.intent.action.VIEW;'
870
+ + 'category=android.intent.category.BROWSABLE;';
871
+ if (packageName !== undefined)
872
+ intent = intent + 'package=' + packageName + ';';
873
+ if (fallback !== undefined && typeof fallback === 'string')
874
+ intent = intent + 'S.browser_fallback_url=' + fallback + ';';
875
+ else if (packageName !== undefined)
876
+ intent = intent + 'S.browser_fallback_url=' + createAppStoreURL(packageName, OS.Android) + ';';
877
+ return intent + 'end';
878
+ }
879
+ function parseIntentURL(intent) {
880
+ var parsed = {};
881
+ var split = intent.split('#Intent;');
882
+ var host = split[0].substring(9);
883
+ var suffix = split[1];
884
+ var parameterString = suffix.substring(0, suffix.length - 4);
885
+ var parameters = parameterString.split(';');
886
+ var extras = {};
887
+ for (var i = 0; i < parameters.length; i++) {
888
+ var part = parameters[i];
889
+ var index = part.indexOf('=');
890
+ if (index !== -1)
891
+ extras[part.substring(0, index)] = part.substring(index + 1);
681
892
  }
682
- catch (_) {
683
- fake = globalThis.document.createEvent('MouseEvents');
684
- fake.initMouseEvent('click', true, true, view, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
893
+ if (extras['scheme'] !== undefined)
894
+ parsed.scheme = (extras['scheme'] + '://' + host);
895
+ if (extras['package'] !== undefined)
896
+ parsed.packageName = extras['package'];
897
+ if (extras['S.browser_fallback_url'] !== undefined)
898
+ parsed.fallback = extras['S.browser_fallback_url'];
899
+ return parsed;
900
+ }
901
+ function createAppStoreURL(packageName, os) {
902
+ if (packageName === undefined)
903
+ return undefined;
904
+ switch (os) {
905
+ case OS.Android:
906
+ return 'market://details?id=' + packageName;
907
+ case OS.iOS:
908
+ return 'itms-apps://itunes.apple.com/app/id' + packageName + '?mt=8';
909
+ case OS.Windows:
910
+ return 'ms-windows-store://pdp/?ProductId=' + packageName;
911
+ case OS.MacOS:
912
+ return 'macappstore://itunes.apple.com/app/id' + packageName + '?mt=12';
913
+ default:
914
+ throw new URLOpenError('Unsupported OS: \"' + Platform.userAgent + '\"');
685
915
  }
686
- element.dispatchEvent(fake);
687
916
  }
688
-
689
- function createHiddenElement(tagName, focusable) {
690
- if (focusable === void 0) { focusable = true; }
691
- if (typeof globalThis.document === 'undefined')
917
+ function createWebStoreURL(packageName, os) {
918
+ if (packageName === undefined)
692
919
  return undefined;
693
- var element = globalThis.document.createElement(tagName);
694
- if ('width' in element)
695
- element.width = '0';
696
- if ('height' in element)
697
- element.height = '0';
698
- if ('border' in element)
699
- element.border = '0';
700
- if ('frameBorder' in element)
701
- element.frameBorder = '0';
702
- if ('scrolling' in element)
703
- element.scrolling = 'no';
704
- if ('cellPadding' in element)
705
- element.cellPadding = '0';
706
- if ('cellSpacing' in element)
707
- element.cellSpacing = '0';
708
- if ('frame' in element)
709
- element.frame = 'void';
710
- if ('rules' in element)
711
- element.rules = 'none';
712
- if ('noWrap' in element)
713
- element.noWrap = true;
714
- element.tabIndex = -1;
715
- element.setAttribute('role', 'presentation');
716
- if (focusable) {
717
- element.style.width = '1px';
718
- element.style.height = '1px';
920
+ switch (os) {
921
+ case OS.Android:
922
+ return 'https://play.google.com/store/apps/details?id=' + packageName;
923
+ case OS.iOS:
924
+ return 'https://itunes.apple.com/app/id' + packageName + '?mt=8';
925
+ case OS.Windows:
926
+ return 'https://apps.microsoft.com/detail/' + packageName;
927
+ case OS.MacOS:
928
+ return 'https://apps.apple.com/app/id' + packageName + '?mt=12';
929
+ default:
930
+ throw new URLOpenError('Unsupported OS: \"' + Platform.userAgent + '\"');
719
931
  }
720
- else {
721
- element.setAttribute('aria-hidden', 'true');
722
- element.style.width = '0';
723
- element.style.height = '0';
724
- element.style.zIndex = '-9999';
725
- element.style.display = 'none';
726
- element.style.visibility = 'hidden';
727
- element.style.pointerEvents = 'none';
932
+ }
933
+ function getDefaultTimeoutByOS(os) {
934
+ switch (os) {
935
+ case OS.iOS:
936
+ return 2000;
937
+ case OS.Android:
938
+ return 1000;
939
+ default:
940
+ return 750;
728
941
  }
729
- element.style.position = 'absolute';
730
- element.style.top = '0';
731
- element.style.left = '0';
732
- element.style.padding = '0';
733
- element.style.margin = '0';
734
- element.style.border = 'none';
735
- element.style.outline = 'none';
736
- element.style.clip = 'rect(1px, 1px, 1px, 1px)';
737
- element.style.clipPath = 'inset(50%)';
738
- element.style.overflow = 'hidden';
739
- element.style.whiteSpace = 'nowrap';
740
- return element;
741
942
  }
742
-
943
+ function canOpenIntentURL() {
944
+ if (Platform.os !== OS.Android)
945
+ return false;
946
+ if (Platform.browser === Browsers.SamsungInternet && compareVersion(Platform.browserVersion, '17.0.1.69') >= 0 && compareVersion(Platform.browserVersion, '17.0.7.34') < 0)
947
+ return false;
948
+ if (Platform.browser === Browsers.Firefox && compareVersion(Platform.browserVersion, '41.0') < 0)
949
+ return false;
950
+ if (Platform.browser === Browsers.Firefox && compareVersion(Platform.browserVersion, '58.0') >= 0 && compareVersion(Platform.browserVersion, '68.11.0') < 0)
951
+ return false;
952
+ if (Platform.browser === Browsers.Firefox && compareVersion(Platform.browserVersion, '79.0') >= 0 && compareVersion(Platform.browserVersion, '81.2.0') < 0)
953
+ return false;
954
+ if (Platform.browser === Browsers.Firefox && compareVersion(Platform.browserVersion, '96.0') >= 0 && compareVersion(Platform.browserVersion, '107.0') < 0)
955
+ return false;
956
+ if (Platform.browser === Browsers.Opera && compareVersion(Platform.browserVersion, '14.0') < 0)
957
+ return false;
958
+ if (/(?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/[\w.]+;/i.test(Platform.userAgent) || /instagram[\/ ][-\w.]+/i.test(Platform.userAgent) || /micromessenger\/([\w.]+)/i.test(Platform.userAgent) || /musical_ly(?:.+app_?version\/|_)[\w.]+/i.test(Platform.userAgent) || /ultralite app_version\/[\w.]+/i.test(Platform.userAgent))
959
+ return false;
960
+ return true;
961
+ }
962
+ function canOpenUniversalURL() {
963
+ return Platform.os === OS.iOS && compareVersion(Platform.osVersion, '9.0') >= 0;
964
+ }
965
+ function getURLOpenError(tried) {
966
+ var triedURLString = '';
967
+ for (var i = 0; i < tried.length; i++)
968
+ triedURLString += '\n' + (i + 1) + ': ' + tried[i];
969
+ if (triedURLString.length > 0)
970
+ triedURLString = '\n' + triedURLString + '\n';
971
+ return new URLOpenError('Failed to open any of the provided URLs: ' + triedURLString);
972
+ }
743
973
  function openURLViaHref(url, index) {
744
974
  var top = getTopmostWindow();
745
975
  var topDocument = top.document;
@@ -903,16 +1133,9 @@
903
1133
  }
904
1134
  function tryOpenURLViaElectron(url) {
905
1135
  try {
906
- var shell_1;
907
- if (typeof globalThis.electronBridge !== 'undefined') {
908
- shell_1 = globalThis.electronBridge;
909
- }
910
- else {
911
- var electron = require('electron');
912
- shell_1 = electron.shell;
913
- }
1136
+ var electron_1 = require('electron');
914
1137
  return new Promise(function (resolve, reject) {
915
- shell_1
1138
+ electron_1.shell
916
1139
  .openExternal(url)
917
1140
  .then(resolve)
918
1141
  .catch(reject);
@@ -1038,237 +1261,6 @@
1038
1261
  }
1039
1262
  });
1040
1263
  }
1041
-
1042
- function createCustomError(name, Base) {
1043
- if (Base === void 0) { Base = Error; }
1044
- function CustomError(message) {
1045
- if (!(this instanceof CustomError))
1046
- return new CustomError(message);
1047
- var error = new Base(message || '');
1048
- if (typeof Object.setPrototypeOf === 'function')
1049
- Object.setPrototypeOf(error, CustomError.prototype);
1050
- else
1051
- error.__proto__ = CustomError.prototype;
1052
- error.name = name;
1053
- if (message !== undefined)
1054
- error.message = message;
1055
- if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
1056
- try {
1057
- Object.defineProperty(error, Symbol.toStringTag, {
1058
- value: name,
1059
- writable: false,
1060
- enumerable: false,
1061
- configurable: true
1062
- });
1063
- }
1064
- catch (_) {
1065
- }
1066
- }
1067
- if (typeof Error.captureStackTrace === 'function') {
1068
- Error.captureStackTrace(error, CustomError);
1069
- }
1070
- else if (Base.captureStackTrace && typeof Base.captureStackTrace === 'function') {
1071
- Base.captureStackTrace(error, CustomError);
1072
- }
1073
- else {
1074
- try {
1075
- var tempError = new Base();
1076
- if (tempError.stack)
1077
- error.stack = tempError.stack;
1078
- }
1079
- catch (_) {
1080
- }
1081
- }
1082
- return error;
1083
- }
1084
- CustomError.prototype = Object.create(Base.prototype, {
1085
- constructor: {
1086
- value: CustomError,
1087
- writable: true,
1088
- enumerable: false,
1089
- configurable: true
1090
- }
1091
- });
1092
- try {
1093
- Object.defineProperty(CustomError.prototype, 'name', {
1094
- value: name,
1095
- writable: true,
1096
- enumerable: false,
1097
- configurable: true
1098
- });
1099
- }
1100
- catch (_) {
1101
- try {
1102
- CustomError.prototype.name = name;
1103
- }
1104
- catch (_) {
1105
- }
1106
- }
1107
- try {
1108
- Object.defineProperty(CustomError, 'name', {
1109
- value: name,
1110
- writable: false,
1111
- enumerable: false,
1112
- configurable: true
1113
- });
1114
- }
1115
- catch (_) {
1116
- }
1117
- return CustomError;
1118
- }
1119
-
1120
- var URLOpenError = createCustomError('URLOpenError');
1121
-
1122
- var _a;
1123
- var App = {
1124
- open: open,
1125
- messenger: (_a = {},
1126
- _a[MessengerType.Telephone] = openMessengerTelephone,
1127
- _a[MessengerType.Message] = openMessengerMessage,
1128
- _a[MessengerType.Mail] = openMessengerMail,
1129
- _a),
1130
- };
1131
- function getTrackId(bundle) {
1132
- try {
1133
- var xhr = new XMLHttpRequest();
1134
- xhr.open('GET', 'https://itunes.apple.com/lookup?bundleId=' + bundle, false);
1135
- xhr.send();
1136
- if (xhr.status === 200) {
1137
- try {
1138
- var response = JSON.parse(xhr.response);
1139
- if (response.results === undefined)
1140
- return undefined;
1141
- var results = response.results;
1142
- if (!Array.isArray(results) || results.length === 0)
1143
- return undefined;
1144
- var result = results[0];
1145
- if (result === undefined)
1146
- return undefined;
1147
- return result.trackId;
1148
- }
1149
- catch (_) {
1150
- return undefined;
1151
- }
1152
- }
1153
- return undefined;
1154
- }
1155
- catch (_) {
1156
- return undefined;
1157
- }
1158
- }
1159
- function createIntentURL(scheme, packageName, fallback) {
1160
- var split = scheme.split('://');
1161
- var prefix = split[0];
1162
- var suffix = split[1];
1163
- var intent = 'intent://';
1164
- if (suffix !== undefined)
1165
- intent = intent + suffix;
1166
- intent = intent + '#Intent;'
1167
- + 'scheme=' + prefix + ';'
1168
- + 'action=android.intent.action.VIEW;'
1169
- + 'category=android.intent.category.BROWSABLE;';
1170
- if (packageName !== undefined)
1171
- intent = intent + 'package=' + packageName + ';';
1172
- if (fallback !== undefined && typeof fallback === 'string')
1173
- intent = intent + 'S.browser_fallback_url=' + fallback + ';';
1174
- else if (packageName !== undefined)
1175
- intent = intent + 'S.browser_fallback_url=' + createAppStoreURL(packageName, OS.Android) + ';';
1176
- return intent + 'end';
1177
- }
1178
- function parseIntentURL(intent) {
1179
- var parsed = {};
1180
- var split = intent.split('#Intent;');
1181
- var host = split[0].substring(9);
1182
- var suffix = split[1];
1183
- var parameterString = suffix.substring(0, suffix.length - 4);
1184
- var parameters = parameterString.split(';');
1185
- var extras = {};
1186
- for (var i = 0; i < parameters.length; i++) {
1187
- var part = parameters[i];
1188
- var index = part.indexOf('=');
1189
- if (index !== -1)
1190
- extras[part.substring(0, index)] = part.substring(index + 1);
1191
- }
1192
- if (extras['scheme'] !== undefined)
1193
- parsed.scheme = (extras['scheme'] + '://' + host);
1194
- if (extras['package'] !== undefined)
1195
- parsed.packageName = extras['package'];
1196
- if (extras['S.browser_fallback_url'] !== undefined)
1197
- parsed.fallback = extras['S.browser_fallback_url'];
1198
- return parsed;
1199
- }
1200
- function createAppStoreURL(packageName, os) {
1201
- if (packageName === undefined)
1202
- return undefined;
1203
- switch (os) {
1204
- case OS.Android:
1205
- return 'market://details?id=' + packageName;
1206
- case OS.iOS:
1207
- return 'itms-apps://itunes.apple.com/app/id' + packageName + '?mt=8';
1208
- case OS.Windows:
1209
- return 'ms-windows-store://pdp/?ProductId=' + packageName;
1210
- case OS.MacOS:
1211
- return 'macappstore://itunes.apple.com/app/id' + packageName + '?mt=12';
1212
- default:
1213
- throw new URLOpenError('Unsupported OS: \"' + Platform.userAgent + '\"');
1214
- }
1215
- }
1216
- function createWebStoreURL(packageName, os) {
1217
- if (packageName === undefined)
1218
- return undefined;
1219
- switch (os) {
1220
- case OS.Android:
1221
- return 'https://play.google.com/store/apps/details?id=' + packageName;
1222
- case OS.iOS:
1223
- return 'https://itunes.apple.com/app/id' + packageName + '?mt=8';
1224
- case OS.Windows:
1225
- return 'https://apps.microsoft.com/detail/' + packageName;
1226
- case OS.MacOS:
1227
- return 'https://apps.apple.com/app/id' + packageName + '?mt=12';
1228
- default:
1229
- throw new URLOpenError('Unsupported OS: \"' + Platform.userAgent + '\"');
1230
- }
1231
- }
1232
- function getDefaultTimeoutByOS(os) {
1233
- switch (os) {
1234
- case OS.iOS:
1235
- return 2000;
1236
- case OS.Android:
1237
- return 1000;
1238
- default:
1239
- return 750;
1240
- }
1241
- }
1242
- function canOpenIntentURL() {
1243
- if (Platform.os !== OS.Android)
1244
- return false;
1245
- if (Platform.browser === Browsers.SamsungInternet && compareVersion(Platform.browserVersion, '17.0.1.69') >= 0 && compareVersion(Platform.browserVersion, '17.0.7.34') < 0)
1246
- return false;
1247
- if (Platform.browser === Browsers.Firefox && compareVersion(Platform.browserVersion, '41.0') < 0)
1248
- return false;
1249
- if (Platform.browser === Browsers.Firefox && compareVersion(Platform.browserVersion, '58.0') >= 0 && compareVersion(Platform.browserVersion, '68.11.0') < 0)
1250
- return false;
1251
- if (Platform.browser === Browsers.Firefox && compareVersion(Platform.browserVersion, '79.0') >= 0 && compareVersion(Platform.browserVersion, '81.2.0') < 0)
1252
- return false;
1253
- if (Platform.browser === Browsers.Firefox && compareVersion(Platform.browserVersion, '96.0') >= 0 && compareVersion(Platform.browserVersion, '107.0') < 0)
1254
- return false;
1255
- if (Platform.browser === Browsers.Opera && compareVersion(Platform.browserVersion, '14.0') < 0)
1256
- return false;
1257
- if (/(?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/[\w.]+;/i.test(Platform.userAgent) || /instagram[\/ ][-\w.]+/i.test(Platform.userAgent) || /micromessenger\/([\w.]+)/i.test(Platform.userAgent) || /musical_ly(?:.+app_?version\/|_)[\w.]+/i.test(Platform.userAgent) || /ultralite app_version\/[\w.]+/i.test(Platform.userAgent))
1258
- return false;
1259
- return true;
1260
- }
1261
- function canOpenUniversalURL() {
1262
- return Platform.os === OS.iOS && compareVersion(Platform.osVersion, '9.0') >= 0;
1263
- }
1264
- function getURLOpenError(tried) {
1265
- var triedURLString = '';
1266
- for (var i = 0; i < tried.length; i++)
1267
- triedURLString += '\n' + (i + 1) + ': ' + tried[i];
1268
- if (triedURLString.length > 0)
1269
- triedURLString = '\n' + triedURLString + '\n';
1270
- return new URLOpenError('Failed to open any of the provided URLs: ' + triedURLString);
1271
- }
1272
1264
  function open(options) {
1273
1265
  var os = Platform.os;
1274
1266
  var urls = [];