Browse Source

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 years ago
parent
commit
79d51bc379

+ 0
- 4
react/config.js View File

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 View File

20
 
20
 
21
 declare var APP: Object;
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
  * Base (abstract) class for main App component.
29
  * Base (abstract) class for main App component.
25
  *
30
  *
32
      * @static
37
      * @static
33
      */
38
      */
34
     static propTypes = {
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
         store: React.PropTypes.object,
48
         store: React.PropTypes.object,
37
 
49
 
38
         /**
50
         /**
193
     _createElement(component, props) {
205
     _createElement(component, props) {
194
         /* eslint-disable no-unused-vars, lines-around-comment */
206
         /* eslint-disable no-unused-vars, lines-around-comment */
195
         const {
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
             // Don't propagate the dispatch and store props because they usually
211
             // Don't propagate the dispatch and store props because they usually
201
             // come from react-redux and programmers don't really expect them to
212
             // come from react-redux and programmers don't really expect them to
202
             // be inherited but rather explicitly connected.
213
             // be inherited but rather explicitly connected.
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 View File

14
      *
14
      *
15
      * @static
15
      * @static
16
      */
16
      */
17
-    static propTypes = AbstractApp.propTypes
17
+    static propTypes = AbstractApp.propTypes;
18
 
18
 
19
     /**
19
     /**
20
      * Initializes a new App instance.
20
      * Initializes a new App instance.

+ 0
- 2
react/index.native.js View File

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

+ 1
- 4
react/index.web.js View File

5
 
5
 
6
 import { getJitsiMeetTransport } from '../modules/transport';
6
 import { getJitsiMeetTransport } from '../modules/transport';
7
 
7
 
8
-import config from './config';
9
 import { App } from './features/app';
8
 import { App } from './features/app';
10
 
9
 
11
 const logger = require('jitsi-meet-logger').getLogger(__filename);
10
 const logger = require('jitsi-meet-logger').getLogger(__filename);
20
     logger.log('(TIME) document ready:\t', now);
19
     logger.log('(TIME) document ready:\t', now);
21
 
20
 
22
     // Render the main Component.
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…
Cancel
Save