|
@@ -1,4 +1,4 @@
|
1
|
|
-/* global APP, $, interfaceConfig, config */
|
|
1
|
+/* global APP, $, interfaceConfig */
|
2
|
2
|
|
3
|
3
|
import React, { Component } from 'react';
|
4
|
4
|
import { connect as reactReduxConnect } from 'react-redux';
|
|
@@ -7,11 +7,7 @@ import {
|
7
|
7
|
connect,
|
8
|
8
|
disconnect
|
9
|
9
|
} from '../../base/connection';
|
10
|
|
-import ConferenceUrl from '../../../../modules/URL/ConferenceUrl';
|
11
|
|
-import HttpConfigFetch from '../../../../modules/config/HttpConfigFetch';
|
12
|
|
-import BoshAddressChoice from '../../../../modules/config/BoshAddressChoice';
|
13
|
|
-
|
14
|
|
-const logger = require('jitsi-meet-logger').getLogger(__filename);
|
|
10
|
+import { obtainConfigAndInit } from '../actions';
|
15
|
11
|
|
16
|
12
|
/**
|
17
|
13
|
* For legacy reasons, inline style for display none.
|
|
@@ -33,88 +29,7 @@ class Conference extends Component {
|
33
|
29
|
* @inheritdoc
|
34
|
30
|
*/
|
35
|
31
|
componentDidMount() {
|
36
|
|
-
|
37
|
|
- /**
|
38
|
|
- * If JWT token data it will be used for local user settings.
|
39
|
|
- *
|
40
|
|
- * @returns {void}
|
41
|
|
- */
|
42
|
|
- function setTokenData() {
|
43
|
|
- const localUser = APP.tokenData.caller;
|
44
|
|
-
|
45
|
|
- if (localUser) {
|
46
|
|
- const email = localUser.getEmail();
|
47
|
|
- const avatarUrl = localUser.getAvatarUrl();
|
48
|
|
- const name = localUser.getName();
|
49
|
|
-
|
50
|
|
- APP.settings.setEmail((email || '').trim(), true);
|
51
|
|
- APP.settings.setAvatarUrl((avatarUrl || '').trim());
|
52
|
|
- APP.settings.setDisplayName((name || '').trim(), true);
|
53
|
|
- }
|
54
|
|
- }
|
55
|
|
-
|
56
|
|
- /**
|
57
|
|
- * Initialization of the app.
|
58
|
|
- *
|
59
|
|
- * @returns {void}
|
60
|
|
- */
|
61
|
|
- function init() {
|
62
|
|
- setTokenData();
|
63
|
|
-
|
64
|
|
- // Initialize the conference URL handler
|
65
|
|
- APP.ConferenceUrl = new ConferenceUrl(window.location);
|
66
|
|
- }
|
67
|
|
-
|
68
|
|
- /**
|
69
|
|
- * If we have an HTTP endpoint for getting config.json configured
|
70
|
|
- * we're going to read it and override properties from config.js and
|
71
|
|
- * interfaceConfig.js. If there is no endpoint we'll just
|
72
|
|
- * continue with initialization.
|
73
|
|
- * Keep in mind that if the endpoint has been configured and we fail
|
74
|
|
- * to obtain the config for any reason then the conference won't
|
75
|
|
- * start and error message will be displayed to the user.
|
76
|
|
- *
|
77
|
|
- * @returns {void}
|
78
|
|
- */
|
79
|
|
- function obtainConfigAndInit() {
|
80
|
|
- const room = APP.conference.roomName;
|
81
|
|
-
|
82
|
|
- if (config.configLocation) {
|
83
|
|
- const configFetch = HttpConfigFetch;
|
84
|
|
- const location = config.configLocation;
|
85
|
|
-
|
86
|
|
- configFetch.obtainConfig(location, room, obtainConfigHandler);
|
87
|
|
- } else {
|
88
|
|
- BoshAddressChoice.chooseAddress(config, room);
|
89
|
|
- init();
|
90
|
|
- }
|
91
|
|
- }
|
92
|
|
-
|
93
|
|
- /**
|
94
|
|
- * Obtain config handler.
|
95
|
|
- *
|
96
|
|
- * @param {boolean} success - Equals to true if
|
97
|
|
- * config has been obtained w/o errors.
|
98
|
|
- * @param {Object} error - Error object if there is error occured
|
99
|
|
- * while fetching config.
|
100
|
|
- * @returns {void}
|
101
|
|
- */
|
102
|
|
- function obtainConfigHandler(success, error) {
|
103
|
|
- if (success) {
|
104
|
|
- const now = window.performance.now();
|
105
|
|
-
|
106
|
|
- APP.connectionTimes['configuration.fetched'] = now;
|
107
|
|
- logger.log('(TIME) configuration fetched:\t', now);
|
108
|
|
- init();
|
109
|
|
- } else {
|
110
|
|
- // Show obtain config error,
|
111
|
|
- // pass the error object for report
|
112
|
|
- APP.UI.messageHandler.openReportDialog(
|
113
|
|
- null, 'dialog.connectError', error);
|
114
|
|
- }
|
115
|
|
- }
|
116
|
|
-
|
117
|
|
- obtainConfigAndInit();
|
|
32
|
+ this.props.dispatch(obtainConfigAndInit());
|
118
|
33
|
APP.UI.start();
|
119
|
34
|
|
120
|
35
|
// XXX Temporary solution until we add React translation.
|