From 79d51bc37986938ac7772f9e4933695552778dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Fri, 9 Jun 2017 12:26:21 +0200 Subject: [PATCH] feat(App): remove obsolete config prop It's obsolete now, since config is handled in Redux. Also add a "defaultUrl" prop so emdedding applications can select what the default base URL is. --- react/config.js | 4 -- react/features/app/components/AbstractApp.js | 40 +++++++++----------- react/features/app/components/App.web.js | 2 +- react/index.native.js | 2 - react/index.web.js | 5 +-- 5 files changed, 19 insertions(+), 34 deletions(-) delete mode 100644 react/config.js diff --git a/react/config.js b/react/config.js deleted file mode 100644 index 2097ed623..000000000 --- a/react/config.js +++ /dev/null @@ -1,4 +0,0 @@ -/* global config */ - -// For legacy reasons, use jitsi-meet's global variable config. -export default typeof config === 'object' ? config : undefined; diff --git a/react/features/app/components/AbstractApp.js b/react/features/app/components/AbstractApp.js index 4c7ace459..8225bb54b 100644 --- a/react/features/app/components/AbstractApp.js +++ b/react/features/app/components/AbstractApp.js @@ -20,6 +20,11 @@ import { declare var APP: Object; +/** + * Default URL to be loaded if no other was specified using props. + */ +const DEFAULT_URL = 'https://meet.jit.si'; + /** * Base (abstract) class for main App component. * @@ -32,7 +37,14 @@ export class AbstractApp extends Component { * @static */ static propTypes = { - config: React.PropTypes.object, + /** + * Default URL to be loaded by the app when not in any room. + */ + defaultUrl: React.PropTypes.string, + + /** + * (Optional) Redux store for this app. + */ store: React.PropTypes.object, /** @@ -193,10 +205,9 @@ export class AbstractApp extends Component { _createElement(component, props) { /* eslint-disable no-unused-vars, lines-around-comment */ const { - // Don't propagate the config prop(erty) because the config is - // stored inside the Redux state and, thus, is visible to the - // children anyway. - config, + // The defaultUrl property was introduced to be consumed entirely by + // AbstractApp. + defaultUrl, // Don't propagate the dispatch and store props because they usually // come from react-redux and programmers don't really expect them to // be inherited but rather explicitly connected. @@ -265,24 +276,7 @@ export class AbstractApp extends Component { } } - // By default, open the domain configured in the configuration file - // which may be the domain at which the whole server infrastructure is - // deployed. - const { config } = this.props; - - if (typeof config === 'object') { - const { hosts } = config; - - if (typeof hosts === 'object') { - const { domain } = hosts; - - if (domain) { - return `https://${domain}`; - } - } - } - - return 'https://meet.jit.si'; + return this.props.defaultUrl || DEFAULT_URL; } /** diff --git a/react/features/app/components/App.web.js b/react/features/app/components/App.web.js index 0488f4d23..c4b799b71 100644 --- a/react/features/app/components/App.web.js +++ b/react/features/app/components/App.web.js @@ -14,7 +14,7 @@ export class App extends AbstractApp { * * @static */ - static propTypes = AbstractApp.propTypes + static propTypes = AbstractApp.propTypes; /** * Initializes a new App instance. diff --git a/react/index.native.js b/react/index.native.js index 0fae6971f..fd6004b69 100644 --- a/react/index.native.js +++ b/react/index.native.js @@ -2,7 +2,6 @@ import 'es6-symbol/implement'; import React, { Component } from 'react'; import { AppRegistry, Linking } from 'react-native'; -import config from './config'; import { App } from './features/app'; /** @@ -65,7 +64,6 @@ class Root extends Component { return ( ); } diff --git a/react/index.web.js b/react/index.web.js index 987e1d4fc..cb9b594f7 100644 --- a/react/index.web.js +++ b/react/index.web.js @@ -5,7 +5,6 @@ import ReactDOM from 'react-dom'; import { getJitsiMeetTransport } from '../modules/transport'; -import config from './config'; import { App } from './features/app'; const logger = require('jitsi-meet-logger').getLogger(__filename); @@ -20,9 +19,7 @@ document.addEventListener('DOMContentLoaded', () => { logger.log('(TIME) document ready:\t', now); // Render the main Component. - ReactDOM.render( - , - document.getElementById('react')); + ReactDOM.render(, document.getElementById('react')); }); /**