@plattar/plattar-ar-adapter 1.139.2 → 1.140.2

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.
@@ -6,8 +6,13 @@ export declare class Util {
6
6
  static canQuicklook(): boolean;
7
7
  static canSceneViewer(): boolean;
8
8
  static canRealityViewer(): boolean;
9
- static isSafari(): boolean;
9
+ static isSafariOnIOS(): boolean;
10
10
  static isChromeOnIOS(): boolean;
11
+ static isIOS(): boolean;
12
+ static isAndroid(): boolean;
13
+ static isFirefox(): boolean;
14
+ static isOculus(): boolean;
15
+ static isSafari(): boolean;
11
16
  static getIOSVersion(): number[];
12
17
  static getChromeVersion(): number;
13
18
  }
package/dist/util/util.js CHANGED
@@ -6,58 +6,45 @@ exports.Util = void 0;
6
6
  */
7
7
  class Util {
8
8
  static canAugment() {
9
- const userAgent = navigator.userAgent;
10
- // test google chrome on IOS and standard IOS test
11
- if ((/CriOS/i.test(userAgent) || /Macintosh|iPad|iPhone|iPod/.test(userAgent)) && !window.MSStream) {
12
- // inside facebook browser
13
- if (/\bFB[\w_]+\//.test(userAgent)) {
14
- return false;
15
- }
16
- // inside instagram browser
17
- if (/\bInstagram/i.test(userAgent)) {
18
- return false;
9
+ return Util.canQuicklook() || Util.canSceneViewer();
10
+ }
11
+ static canQuicklook() {
12
+ if (Util.isIOS()) {
13
+ const isWKWebView = Boolean((window && window).webkit && window.webkit.messageHandlers);
14
+ if (isWKWebView) {
15
+ return Boolean(/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent));
19
16
  }
20
- return Util.canQuicklook();
21
- }
22
- else if (/android/i.test(userAgent)) {
23
- return true;
17
+ const tempAnchor = document.createElement("a");
18
+ return tempAnchor.relList && tempAnchor.relList.supports && tempAnchor.relList.supports("ar");
24
19
  }
25
20
  return false;
26
21
  }
27
- static canQuicklook() {
28
- const tempAnchor = document.createElement("a");
29
- return tempAnchor.relList &&
30
- tempAnchor.relList.supports &&
31
- tempAnchor.relList.supports("ar");
32
- }
33
22
  static canSceneViewer() {
34
- return Util.canAugment() && /android/i.test(navigator.userAgent);
23
+ return Util.isAndroid() && !Util.isFirefox() && !Util.isOculus();
35
24
  }
36
25
  static canRealityViewer() {
37
- if (!Util.canAugment()) {
38
- return false;
39
- }
40
- if (/Macintosh|iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
41
- if (Util.isSafari() && Util.getIOSVersion()[0] >= 13) {
42
- return true;
43
- }
44
- }
45
- return false;
26
+ return Util.isIOS() && Util.getIOSVersion()[0] >= 13;
46
27
  }
47
- static isSafari() {
48
- if (navigator.vendor && navigator.userAgent) {
49
- return navigator.vendor.indexOf("Apple") > -1 &&
50
- navigator.userAgent.indexOf("CriOS") === -1 &&
51
- navigator.userAgent.indexOf("FxiOS") === -1;
52
- }
53
- return false;
28
+ static isSafariOnIOS() {
29
+ return Util.isIOS() && Util.isSafari();
54
30
  }
55
31
  static isChromeOnIOS() {
56
- const userAgent = navigator.userAgent;
57
- if (userAgent) {
58
- return Util.canAugment() && /CriOS/i.test(userAgent);
59
- }
60
- return false;
32
+ return Util.isIOS() && /CriOS\//.test(navigator.userAgent);
33
+ }
34
+ static isIOS() {
35
+ return (/iPad|iPhone|iPod/.test(navigator.userAgent) && !self.MSStream) || (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1);
36
+ }
37
+ static isAndroid() {
38
+ return /android/i.test(navigator.userAgent);
39
+ }
40
+ static isFirefox() {
41
+ return /firefox/i.test(navigator.userAgent);
42
+ }
43
+ static isOculus() {
44
+ return /OculusBrowser/.test(navigator.userAgent);
45
+ }
46
+ static isSafari() {
47
+ return Util.isIOS() && /Safari\//.test(navigator.userAgent);
61
48
  }
62
49
  static getIOSVersion() {
63
50
  if (/iP(hone|od|ad)/.test(navigator.platform)) {
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "1.139.2";
1
+ declare const _default: "1.140.2";
2
2
  export default _default;
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = "1.139.2";
3
+ exports.default = "1.140.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plattar/plattar-ar-adapter",
3
- "version": "1.139.2",
3
+ "version": "1.140.2",
4
4
  "description": "Plattar AR Adapter for interfacing with Google & Apple WebAR",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -45,8 +45,8 @@
45
45
  },
46
46
  "devDependencies": {
47
47
  "@babel/cli": "^7.19.3",
48
- "@babel/core": "^7.19.6",
49
- "@babel/preset-env": "^7.19.4",
48
+ "@babel/core": "^7.20.2",
49
+ "@babel/preset-env": "^7.20.2",
50
50
  "browserify": "^17.0.0",
51
51
  "typescript": "^4.8.4",
52
52
  "uglify-js": "^3.17.4"