summaryrefslogtreecommitdiffstats
path: root/web/react/utils
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2016-01-11 10:08:13 -0600
committerCorey Hulen <corey@hulen.com>2016-01-11 10:08:13 -0600
commitcffb5215b00dc24e86bbaf9c3d4eaa86b1929152 (patch)
treed6bf74b3657a1e229d4661aa28053da208200143 /web/react/utils
parent01d6a48419d351f92c40f8ed9352fa203cc46e4a (diff)
parent5de20f013323d59bb81f043c47c177157c4f68d3 (diff)
downloadchat-cffb5215b00dc24e86bbaf9c3d4eaa86b1929152.tar.gz
chat-cffb5215b00dc24e86bbaf9c3d4eaa86b1929152.tar.bz2
chat-cffb5215b00dc24e86bbaf9c3d4eaa86b1929152.zip
Merge pull request #1849 from hmhealey/plt1578
PLT-571 Restricted file uploads on iOS Chrome and the iOS app to work around iOS bugs
Diffstat (limited to 'web/react/utils')
-rw-r--r--web/react/utils/utils.jsx15
1 files changed, 15 insertions, 0 deletions
diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx
index 95eca7c3a..2ddd0e5e3 100644
--- a/web/react/utils/utils.jsx
+++ b/web/react/utils/utils.jsx
@@ -74,6 +74,21 @@ export function isSafari() {
return false;
}
+export function isIosChrome() {
+ // https://developer.chrome.com/multidevice/user-agent
+ return navigator.userAgent.indexOf('CriOS') !== -1;
+}
+
+export function isMobileApp() {
+ const userAgent = navigator.userAgent;
+
+ // the mobile app has different user agents for the native api calls and the shim, so handle them both
+ const isApi = userAgent.indexOf('Mattermost') !== -1;
+ const isShim = userAgent.indexOf('iPhone') !== -1 && userAgent.indexOf('Safari') === -1 && userAgent.indexOf('Chrome') === -1;
+
+ return isApi || isShim;
+}
+
export function isInRole(roles, inRole) {
var parts = roles.split(' ');
for (var i = 0; i < parts.length; i++) {