From cf23045f8d13625eb08dd46e4d0ce71024f44f52 Mon Sep 17 00:00:00 2001 From: Leonard Kim Date: Thu, 6 Jun 2019 10:09:54 -0700 Subject: [PATCH] feat(unsupported): provide custom blacklist for branding --- react/features/app/getRouteToRender.js | 26 +++---------------- .../features/base/environment/environment.js | 25 ++++++++++++++++++ react/features/base/environment/index.js | 1 + .../environment/isBlacklistedEnvironment.js | 11 ++++++++ 4 files changed, 40 insertions(+), 23 deletions(-) create mode 100644 react/features/base/environment/environment.js create mode 100644 react/features/base/environment/index.js create mode 100644 react/features/base/environment/isBlacklistedEnvironment.js diff --git a/react/features/app/getRouteToRender.js b/react/features/app/getRouteToRender.js index b897286ec..02a1d9546 100644 --- a/react/features/app/getRouteToRender.js +++ b/react/features/app/getRouteToRender.js @@ -4,9 +4,8 @@ import { generateRoomWithoutSeparator } from 'js-utils/random'; import type { Component } from 'react'; import { isRoomValid } from '../base/conference'; -import JitsiMeetJS from '../base/lib-jitsi-meet'; -import { Platform } from '../base/react'; import { toState } from '../base/redux'; +import { isSupportedBrowser } from '../base/environment'; import { Conference } from '../conference'; import { getDeepLinkingPage } from '../deep-linking'; import { UnsupportedDesktopBrowser } from '../unsupported-browser'; @@ -98,7 +97,7 @@ function _getWebConferenceRoute(state): ?Promise { .then(deepLinkComponent => { if (deepLinkComponent) { route.component = deepLinkComponent; - } else if (_isSupportedBrowser()) { + } else if (isSupportedBrowser()) { route.component = Conference; } else { route.component = UnsupportedDesktopBrowser; @@ -118,7 +117,7 @@ function _getWebWelcomePageRoute(state): Promise { const route = _getEmptyRoute(); if (isWelcomePageUserEnabled(state)) { - if (_isSupportedBrowser()) { + if (isSupportedBrowser()) { route.component = WelcomePage; } else { route.component = UnsupportedDesktopBrowser; @@ -135,25 +134,6 @@ function _getWebWelcomePageRoute(state): Promise { return Promise.resolve(route); } -/** - * Returns whether or not the current browser should allow the app to display. - * - * @returns {boolean} - */ -function _isSupportedBrowser() { - if (navigator.product === 'ReactNative') { - return false; - } - - // We are intentionally allow mobile browsers because: - // - the WelcomePage is mobile ready; - // - if the URL points to a conference, getDeepLinkingPage will take - // care of it. - return Platform.OS === 'android' - || Platform.OS === 'ios' - || JitsiMeetJS.isWebRtcSupported(); -} - /** * Returns the default {@code Route}. * diff --git a/react/features/base/environment/environment.js b/react/features/base/environment/environment.js new file mode 100644 index 000000000..5f6646c16 --- /dev/null +++ b/react/features/base/environment/environment.js @@ -0,0 +1,25 @@ +// @flow + +import JitsiMeetJS from '../lib-jitsi-meet'; +import { Platform } from '../react'; + +import { isBlacklistedEnvironment } from './isBlacklistedEnvironment'; + +/** + * Returns whether or not the current browser should allow the app to display. + * + * @returns {boolean} + */ +export function isSupportedBrowser() { + if (navigator.product === 'ReactNative' || isBlacklistedEnvironment()) { + return false; + } + + // We are intentionally allow mobile browsers because: + // - the WelcomePage is mobile ready; + // - if the URL points to a conference then deep-linking will take + // care of it. + return Platform.OS === 'android' + || Platform.OS === 'ios' + || JitsiMeetJS.isWebRtcSupported(); +} diff --git a/react/features/base/environment/index.js b/react/features/base/environment/index.js new file mode 100644 index 000000000..5d04aebd1 --- /dev/null +++ b/react/features/base/environment/index.js @@ -0,0 +1 @@ +export * from './environment'; diff --git a/react/features/base/environment/isBlacklistedEnvironment.js b/react/features/base/environment/isBlacklistedEnvironment.js new file mode 100644 index 000000000..dd873d24f --- /dev/null +++ b/react/features/base/environment/isBlacklistedEnvironment.js @@ -0,0 +1,11 @@ +/** + * Returns whether or not the current browser is supported for showing meeting + * based on any custom overrides. This file should be overridden with branding + * as needed to fit deployment needs. + * + * @returns {boolean} True the browser is unsupported due to being blacklisted + * by the logic within this function. + */ +export function isBlacklistedEnvironment() { + return false; +}