diff --git a/modules/UI/UI.js b/modules/UI/UI.js
index b80a215bd..75752268f 100644
--- a/modules/UI/UI.js
+++ b/modules/UI/UI.js
@@ -1,4 +1,5 @@
/* global APP, JitsiMeetJS, $, config, interfaceConfig, toastr */
+
const logger = require("jitsi-meet-logger").getLogger(__filename);
var UI = {};
diff --git a/react/features/app/actions.js b/react/features/app/actions.js
index 96cd27549..efbbe6cad 100644
--- a/react/features/app/actions.js
+++ b/react/features/app/actions.js
@@ -1,17 +1,8 @@
import { setRoom } from '../base/conference';
-import {
- getDomain,
- setDomain
-} from '../base/connection';
-import {
- loadConfig,
- setConfig
-} from '../base/lib-jitsi-meet';
+import { getDomain, setDomain } from '../base/connection';
+import { loadConfig, setConfig } from '../base/lib-jitsi-meet';
-import {
- APP_WILL_MOUNT,
- APP_WILL_UNMOUNT
-} from './actionTypes';
+import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from './actionTypes';
import {
_getRoomAndDomainFromUrlString,
_getRouteToRender,
@@ -20,9 +11,9 @@ import {
import './reducer';
/**
- * Temporary solution. Should dispatch actions related to
- * initial settings of the app like setting log levels,
- * reading the config parameters from query string etc.
+ * Temporary solution. Should dispatch actions related to initial settings of
+ * the app like setting log levels, reading the config parameters from query
+ * string etc.
*
* @returns {Function}
*/
diff --git a/react/features/app/components/App.web.js b/react/features/app/components/App.web.js
index 3d8de06a1..942c4884a 100644
--- a/react/features/app/components/App.web.js
+++ b/react/features/app/components/App.web.js
@@ -1,13 +1,7 @@
-/* global $ */
import React from 'react';
import { Provider } from 'react-redux';
-import {
- browserHistory,
- Route,
- Router
-} from 'react-router';
+import { browserHistory, Route, Router } from 'react-router';
import { push, syncHistoryWithStore } from 'react-router-redux';
-import { compose } from 'redux';
import { getDomain } from '../../base/connection';
import { RouteRegistry } from '../../base/navigator';
@@ -45,9 +39,6 @@ export class App extends AbstractApp {
this.history = syncHistoryWithStore(browserHistory, props.store);
// Bind event handlers so they are only bound once for every instance.
- this._getRoute = this._getRoute.bind(this);
- this._getRoutes = this._getRoutes.bind(this);
- this._onRouteEnter = this._onRouteEnter.bind(this);
this._routerCreateElement = this._routerCreateElement.bind(this);
}
@@ -74,44 +65,14 @@ export class App extends AbstractApp {
- { this._getRoutes() }
+ {
+ this._renderRoutes()
+ }
);
}
- /**
- * Method returns route for React Router.
- *
- * @param {Object} route - Object that describes route.
- * @returns {ReactElement}
- * @private
- */
- _getRoute(route) {
- const onEnter = route.onEnter || $.noop;
- const handler = compose(this._onRouteEnter, onEnter);
-
- return (
-
- );
- }
-
- /**
- * Returns routes for application.
- *
- * @returns {Array}
- * @private
- */
- _getRoutes() {
- const routes = RouteRegistry.getRoutes();
-
- return routes.map(this._getRoute);
- }
-
/**
* Navigates to a specific Route (via platform-specific means).
*
@@ -137,10 +98,18 @@ export class App extends AbstractApp {
* Invoked by react-router to notify this App that a Route is about to be
* rendered.
*
+ * @param {Route} route - The Route that is about to be rendered.
* @private
* @returns {void}
*/
- _onRouteEnter() {
+ _onRouteEnter(route, ...args) {
+ // Notify the route that it is about to be entered.
+ const onEnter = route.onEnter;
+
+ if (typeof onEnter === 'function') {
+ onEnter(...args);
+ }
+
// XXX The following is mandatory. Otherwise, moving back & forward
// through the browser's history could leave this App on the Conference
// page without a room name.
@@ -159,6 +128,37 @@ export class App extends AbstractApp {
this._openURL(url);
}
+ /**
+ * Renders a specific Route (for the purposes of the Router of this App).
+ *
+ * @param {Object} route - The Route to render.
+ * @returns {ReactElement}
+ * @private
+ */
+ _renderRoute(route) {
+ const onEnter = (...args) => {
+ this._onRouteEnter(route, ...args);
+ };
+
+ return (
+
+ );
+ }
+
+ /**
+ * Renders the Routes of the Router of this App.
+ *
+ * @returns {Array.}
+ * @private
+ */
+ _renderRoutes() {
+ return RouteRegistry.getRoutes().map(this._renderRoute, this);
+ }
+
/**
* Create a ReactElement from the specified component and props on behalf of
* the associated Router.
diff --git a/react/features/app/functions.native.js b/react/features/app/functions.native.js
index 1c5a6f230..fb67dd1e1 100644
--- a/react/features/app/functions.native.js
+++ b/react/features/app/functions.native.js
@@ -64,8 +64,8 @@ export function _getRoomAndDomainFromUrlString(url) {
url
= match[1] /* URL protocol */
- + '://enso.hipchat.me/'
- + url.substring(regex.lastIndex);
+ + '://enso.hipchat.me/'
+ + url.substring(regex.lastIndex);
/* eslint-enable no-param-reassign, prefer-template */
}
diff --git a/react/features/app/functions.web.js b/react/features/app/functions.web.js
index 5f541c74a..ec4bbee3a 100644
--- a/react/features/app/functions.web.js
+++ b/react/features/app/functions.web.js
@@ -1,143 +1,24 @@
/* global APP, JitsiMeetJS, loggingConfig */
-import { isRoomValid } from '../base/conference';
-import { RouteRegistry } from '../base/navigator';
-import { Conference } from '../conference';
-import { WelcomePage } from '../welcome';
-
-import getTokenData from '../../../modules/tokendata/TokenData';
-import settings from '../../../modules/settings/Settings';
import URLProcessor from '../../../modules/config/URLProcessor';
+import KeyboardShortcut
+ from '../../../modules/keyboardshortcut/keyboardshortcut';
+import settings from '../../../modules/settings/Settings';
+import getTokenData from '../../../modules/tokendata/TokenData';
import JitsiMeetLogStorage from '../../../modules/util/JitsiMeetLogStorage';
-// eslint-disable-next-line max-len
-import KeyboardShortcut from '../../../modules/keyboardshortcut/keyboardshortcut';
-
const Logger = require('jitsi-meet-logger');
-const LogCollector = Logger.LogCollector;
+export * from './functions.native';
/**
- * Gets room name and domain from URL object.
- *
- * @param {URL} url - URL object.
- * @private
- * @returns {{
- * domain: (string|undefined),
- * room: (string|undefined)
- * }}
- */
-function _getRoomAndDomainFromUrlObject(url) {
- let domain;
- let room;
-
- if (url) {
- domain = url.hostname;
- room = url.pathname.substr(1);
-
- // Convert empty string to undefined to simplify checks.
- if (room === '') {
- room = undefined;
- }
- if (domain === '') {
- domain = undefined;
- }
- }
-
- return {
- domain,
- room
- };
-}
-
-/**
- * Gets conference room name and connection domain from URL.
- *
- * @param {(string|undefined)} url - URL.
- * @returns {{
- * domain: (string|undefined),
- * room: (string|undefined)
- * }}
- */
-export function _getRoomAndDomainFromUrlString(url) {
- // Rewrite the specified URL in order to handle special cases such as
- // hipchat.com and enso.me which do not follow the common pattern of most
- // Jitsi Meet deployments.
- if (typeof url === 'string') {
- // hipchat.com
- let regex = /^(https?):\/\/hipchat.com\/video\/call\//gi;
- let match = regex.exec(url);
-
- if (!match) {
- // enso.me
- regex = /^(https?):\/\/enso\.me\/(?:call|meeting)\//gi;
- match = regex.exec(url);
- }
- if (match && match.length > 1) {
- /* eslint-disable no-param-reassign, prefer-template */
-
- url
- = match[1] /* URL protocol */
- + '://enso.hipchat.me/'
- + url.substring(regex.lastIndex);
-
- /* eslint-enable no-param-reassign, prefer-template */
- }
- }
-
- return _getRoomAndDomainFromUrlObject(_urlStringToObject(url));
-}
-
-/**
- * Determines which route is to be rendered in order to depict a specific Redux
- * store.
- *
- * @param {(Object|Function)} stateOrGetState - Redux state or Regux getState()
- * method.
- * @returns {Route}
- */
-export function _getRouteToRender(stateOrGetState) {
- const state
- = typeof stateOrGetState === 'function'
- ? stateOrGetState()
- : stateOrGetState;
- const room = state['features/base/conference'].room;
- const component = isRoomValid(room) ? Conference : WelcomePage;
-
- return RouteRegistry.getRouteByComponent(component);
-}
-
-/**
- * Parses a string into a URL (object).
- *
- * @param {(string|undefined)} url - The URL to parse.
- * @private
- * @returns {URL}
- */
-function _urlStringToObject(url) {
- let urlObj;
-
- if (url) {
- try {
- urlObj = new URL(url);
- } catch (ex) {
- // The return value will signal the failure & the logged
- // exception will provide the details to the developers.
- console.log(`${url} seems to be not a valid URL, but it's OK`, ex);
- }
- }
-
- return urlObj;
-}
-
-/**
- * Temporary solution. Later we'll get rid of global APP
- * and set its properties in redux store.
+ * Temporary solution. Later we'll get rid of global APP and set its properties
+ * in redux store.
*
* @returns {void}
*/
export function init() {
- _setConfigParametersFromUrl();
+ URLProcessor.setConfigParametersFromUrl();
_initLogging();
APP.keyboardshortcut = KeyboardShortcut;
@@ -147,36 +28,14 @@ export function init() {
APP.translation.init(settings.getLanguage());
}
-/**
- * Initializes logging in the app.
- *
- * @private
- * @returns {void}
- */
-function _initLogging() {
- // Adjust logging level
- configureLoggingLevels();
-
- // Create the LogCollector and register it as the global log transport.
- // It is done early to capture as much logs as possible. Captured logs
- // will be cached, before the JitsiMeetLogStorage gets ready (statistics
- // module is initialized).
- if (!APP.logCollector && !loggingConfig.disableLogCollector) {
- APP.logCollector = new LogCollector(new JitsiMeetLogStorage());
- Logger.addGlobalTransport(APP.logCollector);
- JitsiMeetJS.addGlobalLogTransport(APP.logCollector);
- }
-}
-
/**
* Adjusts the logging levels.
*
* @private
* @returns {void}
*/
-function configureLoggingLevels() {
- // NOTE The library Logger is separated from
- // the app loggers, so the levels
+function _configureLoggingLevels() {
+ // NOTE The library Logger is separated from the app loggers, so the levels
// have to be set in two places
// Set default logging level
@@ -186,8 +45,8 @@ function configureLoggingLevels() {
Logger.setLogLevel(defaultLogLevel);
JitsiMeetJS.setLogLevel(defaultLogLevel);
- // NOTE console was used on purpose here to go around the logging
- // and always print the default logging level to the console
+ // NOTE console was used on purpose here to go around the logging and always
+ // print the default logging level to the console
console.info(`Default logging level set to: ${defaultLogLevel}`);
// Set log level for each logger
@@ -204,11 +63,22 @@ function configureLoggingLevels() {
}
/**
- * Sets config parameters from query string.
+ * Initializes logging in the app.
*
* @private
* @returns {void}
*/
-function _setConfigParametersFromUrl() {
- URLProcessor.setConfigParametersFromUrl();
+function _initLogging() {
+ // Adjust logging level
+ _configureLoggingLevels();
+
+ // Create the LogCollector and register it as the global log transport. It
+ // is done early to capture as much logs as possible. Captured logs will be
+ // cached, before the JitsiMeetLogStorage gets ready (statistics module is
+ // initialized).
+ if (!APP.logCollector && !loggingConfig.disableLogCollector) {
+ APP.logCollector = new Logger.LogCollector(new JitsiMeetLogStorage());
+ Logger.addGlobalTransport(APP.logCollector);
+ JitsiMeetJS.addGlobalLogTransport(APP.logCollector);
+ }
}
diff --git a/react/features/base/connection/actions.web.js b/react/features/base/connection/actions.web.js
index b81e479e9..e8a65f638 100644
--- a/react/features/base/connection/actions.web.js
+++ b/react/features/base/connection/actions.web.js
@@ -1,14 +1,12 @@
/* global APP, JitsiMeetJS */
-import {
- SET_DOMAIN
-} from './actionTypes';
-import './reducer';
import UIEvents from '../../../../service/UI/UIEvents';
-const logger = require('jitsi-meet-logger').getLogger(__filename);
-const ConferenceEvents = JitsiMeetJS.events.conference;
+import { SET_DOMAIN } from './actionTypes';
+import './reducer';
+const JitsiConferenceEvents = JitsiMeetJS.events.conference;
+const logger = require('jitsi-meet-logger').getLogger(__filename);
/**
* Opens new connection.
@@ -42,7 +40,7 @@ export function connect() {
// room. It will then restart the media session when someone
// eventually join the room which will start the stats again.
APP.conference.addConferenceListener(
- ConferenceEvents.BEFORE_STATISTICS_DISPOSED,
+ JitsiConferenceEvents.BEFORE_STATISTICS_DISPOSED,
() => {
if (APP.logCollector) {
APP.logCollector.flush();
@@ -74,8 +72,8 @@ export function connect() {
* @returns {Function}
*/
export function disconnect() {
- // XXX For web based version we use conference
- // hanging up logic from the old app.
+ // XXX For web based version we use conference hanging up logic from the old
+ // app.
return () => APP.conference.hangup();
}
diff --git a/react/features/base/lib-jitsi-meet/actions.js b/react/features/base/lib-jitsi-meet/actions.js
index ddb69594d..ef9bb8105 100644
--- a/react/features/base/lib-jitsi-meet/actions.js
+++ b/react/features/base/lib-jitsi-meet/actions.js
@@ -1,5 +1,3 @@
-import React from 'react';
-
import JitsiMeetJS from './';
import {
LIB_DISPOSED,
@@ -42,9 +40,9 @@ export function initLib() {
throw new Error('Cannot initialize lib-jitsi-meet without config');
}
- if (!React.View) {
- // XXX Temporarily until conference.js is moved to the React app we
- // shouldn't use JitsiMeetJS from the React app.
+ // XXX Temporarily until conference.js is moved to the React app we
+ // shouldn't use JitsiMeetJS from the React app.
+ if (typeof APP !== 'undefined') {
return Promise.resolve();
}
diff --git a/react/features/base/lib-jitsi-meet/functions.js b/react/features/base/lib-jitsi-meet/functions.js
index 543d64922..03ab8910e 100644
--- a/react/features/base/lib-jitsi-meet/functions.js
+++ b/react/features/base/lib-jitsi-meet/functions.js
@@ -1,5 +1,3 @@
-import React from 'react';
-
import { loadScript } from '../../base/util';
/**
@@ -10,10 +8,10 @@ import { loadScript } from '../../base/util';
* @returns {Promise