Browse Source

Merge pull request #1818 from jitsi/tavram/safari

fix(browser-capabilities) expose supported mobile browsers
dev1
Avram Tudor 3 years ago
parent
commit
161da84ac0
No account linked to committer's email address
1 changed files with 30 additions and 0 deletions
  1. 30
    0
      modules/browser/BrowserCapabilities.js

+ 30
- 0
modules/browser/BrowserCapabilities.js View File

@@ -6,6 +6,7 @@ const logger = getLogger(__filename);
6 6
 /* Minimum required Chrome / Chromium version. This applies also to derivatives. */
7 7
 const MIN_REQUIRED_CHROME_VERSION = 72;
8 8
 const MIN_REQUIRED_SAFARI_VERSION = 14;
9
+const MIN_REQUIRED_IOS_VERSION = 14;
9 10
 
10 11
 // TODO: Move this code to js-utils.
11 12
 
@@ -112,6 +113,22 @@ export default class BrowserCapabilities extends BrowserDetection {
112 113
             || this.isWebKitBased();
113 114
     }
114 115
 
116
+    /**
117
+     * Returns whether the browser is supported for Android
118
+     * @returns {boolean} true if the browser is supported for Android devices
119
+     */
120
+    isSupportedAndroidBrowser() {
121
+        return this.isChromiumBased() || this.isFirefox();
122
+    }
123
+
124
+    /**
125
+     * Returns whether the browser is supported for iOS
126
+     * @returns {boolean} true if the browser is supported for iOS devices
127
+     */
128
+    isSupportedIOSBrowser() {
129
+        return this._getIOSVersion() >= MIN_REQUIRED_IOS_VERSION;
130
+    }
131
+
115 132
     /**
116 133
      * Returns whether or not the current environment needs a user interaction
117 134
      * with the page before any unmute can occur.
@@ -381,4 +398,17 @@ export default class BrowserCapabilities extends BrowserDetection {
381 398
 
382 399
         return -1;
383 400
     }
401
+
402
+    /**
403
+     * Returns the version of an ios browser.
404
+     *
405
+     * @returns {Number}
406
+     */
407
+    _getIOSVersion() {
408
+        if (this.isWebKitBased()) {
409
+            return Number.parseInt(this.getVersion(), 10);
410
+        }
411
+
412
+        return -1;
413
+    }
384 414
 }

Loading…
Cancel
Save