feat(unsupported): provide custom blacklist for branding

This commit is contained in:
Leonard Kim 2019-06-06 10:09:54 -07:00 committed by virtuacoplenny
parent e47d2d13ce
commit cf23045f8d
4 changed files with 40 additions and 23 deletions

View File

@ -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<Route> {
.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<Route> {
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<Route> {
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}.
*

View File

@ -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();
}

View File

@ -0,0 +1 @@
export * from './environment';

View File

@ -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;
}