@plattar/plattar-ar-adapter 1.139.2 → 1.140.1

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.
@@ -2173,58 +2173,45 @@ exports.Util = void 0;
2173
2173
  */
2174
2174
  class Util {
2175
2175
  static canAugment() {
2176
- const userAgent = navigator.userAgent;
2177
- // test google chrome on IOS and standard IOS test
2178
- if ((/CriOS/i.test(userAgent) || /Macintosh|iPad|iPhone|iPod/.test(userAgent)) && !window.MSStream) {
2179
- // inside facebook browser
2180
- if (/\bFB[\w_]+\//.test(userAgent)) {
2181
- return false;
2182
- }
2183
- // inside instagram browser
2184
- if (/\bInstagram/i.test(userAgent)) {
2185
- return false;
2176
+ return Util.canQuicklook() || Util.canSceneViewer();
2177
+ }
2178
+ static canQuicklook() {
2179
+ if (Util.isIOS()) {
2180
+ const isWKWebView = Boolean((window && window).webkit && window.webkit.messageHandlers);
2181
+ if (isWKWebView) {
2182
+ return Boolean(/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent));
2186
2183
  }
2187
- return Util.canQuicklook();
2188
- }
2189
- else if (/android/i.test(userAgent)) {
2190
- return true;
2184
+ const tempAnchor = document.createElement("a");
2185
+ return tempAnchor.relList && tempAnchor.relList.supports && tempAnchor.relList.supports("ar");
2191
2186
  }
2192
2187
  return false;
2193
2188
  }
2194
- static canQuicklook() {
2195
- const tempAnchor = document.createElement("a");
2196
- return tempAnchor.relList &&
2197
- tempAnchor.relList.supports &&
2198
- tempAnchor.relList.supports("ar");
2199
- }
2200
2189
  static canSceneViewer() {
2201
- return Util.canAugment() && /android/i.test(navigator.userAgent);
2190
+ return Util.isAndroid() && !Util.isFirefox() && !Util.isOculus();
2202
2191
  }
2203
2192
  static canRealityViewer() {
2204
- if (!Util.canAugment()) {
2205
- return false;
2206
- }
2207
- if (/Macintosh|iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
2208
- if (Util.isSafari() && Util.getIOSVersion()[0] >= 13) {
2209
- return true;
2210
- }
2211
- }
2212
- return false;
2193
+ return Util.isIOS() && Util.getIOSVersion()[0] >= 13;
2213
2194
  }
2214
- static isSafari() {
2215
- if (navigator.vendor && navigator.userAgent) {
2216
- return navigator.vendor.indexOf("Apple") > -1 &&
2217
- navigator.userAgent.indexOf("CriOS") === -1 &&
2218
- navigator.userAgent.indexOf("FxiOS") === -1;
2219
- }
2220
- return false;
2195
+ static isSafariOnIOS() {
2196
+ return Util.isIOS() && Util.isSafari();
2221
2197
  }
2222
2198
  static isChromeOnIOS() {
2223
- const userAgent = navigator.userAgent;
2224
- if (userAgent) {
2225
- return Util.canAugment() && /CriOS/i.test(userAgent);
2226
- }
2227
- return false;
2199
+ return Util.isIOS() && /CriOS\//.test(navigator.userAgent);
2200
+ }
2201
+ static isIOS() {
2202
+ return (/iPad|iPhone|iPod/.test(navigator.userAgent) && !self.MSStream) || (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1);
2203
+ }
2204
+ static isAndroid() {
2205
+ return /android/i.test(navigator.userAgent);
2206
+ }
2207
+ static isFirefox() {
2208
+ return /firefox/i.test(navigator.userAgent);
2209
+ }
2210
+ static isOculus() {
2211
+ return /OculusBrowser/.test(navigator.userAgent);
2212
+ }
2213
+ static isSafari() {
2214
+ return /Safari\//.test(navigator.userAgent);
2228
2215
  }
2229
2216
  static getIOSVersion() {
2230
2217
  if (/iP(hone|od|ad)/.test(navigator.platform)) {
@@ -2254,7 +2241,7 @@ exports.Util = Util;
2254
2241
  },{}],16:[function(require,module,exports){
2255
2242
  "use strict";
2256
2243
  Object.defineProperty(exports, "__esModule", { value: true });
2257
- exports.default = "1.139.2";
2244
+ exports.default = "1.140.1";
2258
2245
 
2259
2246
  },{}],17:[function(require,module,exports){
2260
2247
  "use strict";