Преглед на файлове

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.
j8
Saúl Ibarra Corretgé преди 8 години
родител
ревизия
79d51bc379
променени са 5 файла, в които са добавени 19 реда и са изтрити 34 реда
  1. 0
    4
      react/config.js
  2. 17
    23
      react/features/app/components/AbstractApp.js
  3. 1
    1
      react/features/app/components/App.web.js
  4. 0
    2
      react/index.native.js
  5. 1
    4
      react/index.web.js

+ 0
- 4
react/config.js Целия файл

@@ -1,4 +0,0 @@
1
-/* global config */
2
-
3
-// For legacy reasons, use jitsi-meet's global variable config.
4
-export default typeof config === 'object' ? config : undefined;

+ 17
- 23
react/features/app/components/AbstractApp.js Целия файл

@@ -20,6 +20,11 @@ import {
20 20
 
21 21
 declare var APP: Object;
22 22
 
23
+/**
24
+ * Default URL to be loaded if no other was specified using props.
25
+ */
26
+const DEFAULT_URL = 'https://meet.jit.si';
27
+
23 28
 /**
24 29
  * Base (abstract) class for main App component.
25 30
  *
@@ -32,7 +37,14 @@ export class AbstractApp extends Component {
32 37
      * @static
33 38
      */
34 39
     static propTypes = {
35
-        config: React.PropTypes.object,
40
+        /**
41
+         * Default URL to be loaded by the app when not in any room.
42
+         */
43
+        defaultUrl: React.PropTypes.string,
44
+
45
+        /**
46
+         * (Optional) Redux store for this app.
47
+         */
36 48
         store: React.PropTypes.object,
37 49
 
38 50
         /**
@@ -193,10 +205,9 @@ export class AbstractApp extends Component {
193 205
     _createElement(component, props) {
194 206
         /* eslint-disable no-unused-vars, lines-around-comment */
195 207
         const {
196
-            // Don't propagate the config prop(erty) because the config is
197
-            // stored inside the Redux state and, thus, is visible to the
198
-            // children anyway.
199
-            config,
208
+            // The defaultUrl property was introduced to be consumed entirely by
209
+            // AbstractApp.
210
+            defaultUrl,
200 211
             // Don't propagate the dispatch and store props because they usually
201 212
             // come from react-redux and programmers don't really expect them to
202 213
             // be inherited but rather explicitly connected.
@@ -265,24 +276,7 @@ export class AbstractApp extends Component {
265 276
             }
266 277
         }
267 278
 
268
-        // By default, open the domain configured in the configuration file
269
-        // which may be the domain at which the whole server infrastructure is
270
-        // deployed.
271
-        const { config } = this.props;
272
-
273
-        if (typeof config === 'object') {
274
-            const { hosts } = config;
275
-
276
-            if (typeof hosts === 'object') {
277
-                const { domain } = hosts;
278
-
279
-                if (domain) {
280
-                    return `https://${domain}`;
281
-                }
282
-            }
283
-        }
284
-
285
-        return 'https://meet.jit.si';
279
+        return this.props.defaultUrl || DEFAULT_URL;
286 280
     }
287 281
 
288 282
     /**

+ 1
- 1
react/features/app/components/App.web.js Целия файл

@@ -14,7 +14,7 @@ export class App extends AbstractApp {
14 14
      *
15 15
      * @static
16 16
      */
17
-    static propTypes = AbstractApp.propTypes
17
+    static propTypes = AbstractApp.propTypes;
18 18
 
19 19
     /**
20 20
      * Initializes a new App instance.

+ 0
- 2
react/index.native.js Целия файл

@@ -2,7 +2,6 @@ import 'es6-symbol/implement';
2 2
 import React, { Component } from 'react';
3 3
 import { AppRegistry, Linking } from 'react-native';
4 4
 
5
-import config from './config';
6 5
 import { App } from './features/app';
7 6
 
8 7
 /**
@@ -65,7 +64,6 @@ class Root extends Component {
65 64
 
66 65
         return (
67 66
             <App
68
-                config = { config }
69 67
                 url = { this.state.url } />
70 68
         );
71 69
     }

+ 1
- 4
react/index.web.js Целия файл

@@ -5,7 +5,6 @@ import ReactDOM from 'react-dom';
5 5
 
6 6
 import { getJitsiMeetTransport } from '../modules/transport';
7 7
 
8
-import config from './config';
9 8
 import { App } from './features/app';
10 9
 
11 10
 const logger = require('jitsi-meet-logger').getLogger(__filename);
@@ -20,9 +19,7 @@ document.addEventListener('DOMContentLoaded', () => {
20 19
     logger.log('(TIME) document ready:\t', now);
21 20
 
22 21
     // Render the main Component.
23
-    ReactDOM.render(
24
-        <App config = { config } />,
25
-        document.getElementById('react'));
22
+    ReactDOM.render(<App />, document.getElementById('react'));
26 23
 });
27 24
 
28 25
 /**

Loading…
Отказ
Запис