瀏覽代碼

fix(conference) unify conference options

Some options were missing on the mobile side, notably calltsts
enableDisplayNameInStats and enableEmailInStats. Now the same logic will be used
in web and mobile.
master
Saúl Ibarra Corretgé 4 年之前
父節點
當前提交
465e7f1458

+ 7
- 2
conference.js 查看文件

@@ -39,6 +39,7 @@ import {
39 39
     conferenceWillJoin,
40 40
     conferenceWillLeave,
41 41
     dataChannelOpened,
42
+    getConferenceOptions,
42 43
     kickedOut,
43 44
     lockStateChanged,
44 45
     onStartMutedPolicyChanged,
@@ -111,7 +112,6 @@ import {
111 112
     trackRemoved
112 113
 } from './react/features/base/tracks';
113 114
 import { downloadJSON } from './react/features/base/util/downloadJSON';
114
-import { getConferenceOptions } from './react/features/conference/functions';
115 115
 import { showDesktopPicker } from './react/features/desktop-picker';
116 116
 import { appendSuffix } from './react/features/display-name';
117 117
 import {
@@ -132,6 +132,7 @@ import { setScreenAudioShareState, isScreenAudioShared } from './react/features/
132 132
 import { toggleScreenshotCaptureEffect } from './react/features/screenshot-capture';
133 133
 import { AudioMixerEffect } from './react/features/stream-effects/audio-mixer/AudioMixerEffect';
134 134
 import { createPresenterEffect } from './react/features/stream-effects/presenter';
135
+import { createRnnoiseProcessor } from './react/features/stream-effects/rnnoise';
135 136
 import { endpointMessageReceived } from './react/features/subtitles';
136 137
 import UIEvents from './service/UI/UIEvents';
137 138
 
@@ -1357,7 +1358,11 @@ export default {
1357 1358
     },
1358 1359
 
1359 1360
     _getConferenceOptions() {
1360
-        return getConferenceOptions(APP.store.getState());
1361
+        const options = getConferenceOptions(APP.store.getState());
1362
+
1363
+        options.createVADProcessor = createRnnoiseProcessor;
1364
+
1365
+        return options;
1361 1366
     },
1362 1367
 
1363 1368
     /**

+ 3
- 23
react/features/base/conference/actions.js 查看文件

@@ -6,7 +6,6 @@ import {
6 6
     createStartMutedConfigurationEvent,
7 7
     sendAnalytics
8 8
 } from '../../analytics';
9
-import { getName } from '../../app/functions';
10 9
 import { endpointMessageReceived } from '../../subtitles';
11 10
 import { getReplaceParticipant } from '../config/functions';
12 11
 import { JITSI_CONNECTION_CONFERENCE_KEY } from '../connection';
@@ -14,7 +13,6 @@ import { JitsiConferenceEvents } from '../lib-jitsi-meet';
14 13
 import { MEDIA_TYPE, setAudioMuted, setVideoMuted } from '../media';
15 14
 import {
16 15
     dominantSpeakerChanged,
17
-    getLocalParticipant,
18 16
     getNormalizedDisplayName,
19 17
     participantConnectionStatusChanged,
20 18
     participantKicked,
@@ -24,11 +22,7 @@ import {
24 22
     participantUpdated
25 23
 } from '../participants';
26 24
 import { getLocalTracks, replaceLocalTrack, trackAdded, trackRemoved } from '../tracks';
27
-import {
28
-    getBackendSafePath,
29
-    getBackendSafeRoomName,
30
-    getJitsiMeetGlobalNS
31
-} from '../util';
25
+import { getBackendSafeRoomName } from '../util';
32 26
 
33 27
 import {
34 28
     AUTH_STATUS_CHANGED,
@@ -61,6 +55,7 @@ import {
61 55
     _addLocalTracksToConference,
62 56
     commonUserJoinedHandling,
63 57
     commonUserLeftHandling,
58
+    getConferenceOptions,
64 59
     getCurrentConference,
65 60
     sendLocalParticipant
66 61
 } from './functions';
@@ -434,22 +429,7 @@ export function createConference() {
434 429
             throw new Error('Cannot join a conference without a room name!');
435 430
         }
436 431
 
437
-        const config = state['features/base/config'];
438
-        const { tenant } = state['features/base/jwt'];
439
-        const { email, name: nick } = getLocalParticipant(state);
440
-
441
-        const conference
442
-            = connection.initJitsiConference(
443
-
444
-                getBackendSafeRoomName(room), {
445
-                    ...config,
446
-                    applicationName: getName(),
447
-                    getWiFiStatsMethod: getJitsiMeetGlobalNS().getWiFiStats,
448
-                    confID: `${locationURL.host}${getBackendSafePath(locationURL.pathname)}`,
449
-                    siteID: tenant,
450
-                    statisticsDisplayName: config.enableDisplayNameInStats ? nick : undefined,
451
-                    statisticsId: config.enableEmailInStats ? email : undefined
452
-                });
432
+        const conference = connection.initJitsiConference(getBackendSafeRoomName(room), getConferenceOptions(state));
453 433
 
454 434
         connection[JITSI_CONNECTION_CONFERENCE_KEY] = conference;
455 435
 

+ 64
- 1
react/features/base/conference/functions.js 查看文件

@@ -2,6 +2,7 @@
2 2
 
3 3
 import _ from 'lodash';
4 4
 
5
+import { getName } from '../../app/functions';
5 6
 import { JitsiTrackErrors } from '../lib-jitsi-meet';
6 7
 import {
7 8
     getLocalParticipant,
@@ -11,7 +12,7 @@ import {
11 12
     participantLeft
12 13
 } from '../participants';
13 14
 import { toState } from '../redux';
14
-import { safeDecodeURIComponent } from '../util';
15
+import { getBackendSafePath, getJitsiMeetGlobalNS, safeDecodeURIComponent } from '../util';
15 16
 
16 17
 import {
17 18
     AVATAR_URL_COMMAND,
@@ -198,6 +199,53 @@ export function getConferenceNameForTitle(stateful: Function | Object) {
198 199
     return safeStartCase(safeDecodeURIComponent(getConferenceState(toState(stateful)).room));
199 200
 }
200 201
 
202
+/**
203
+ * Returns an object aggregating the conference options.
204
+ *
205
+ * @param {Object|Function} stateful - The redux store state.
206
+ * @returns {Object} - Options object.
207
+ */
208
+export function getConferenceOptions(stateful: Function | Object) {
209
+    const state = toState(stateful);
210
+
211
+    const config = state['features/base/config'];
212
+    const { locationURL } = state['features/base/connection'];
213
+    const { tenant } = state['features/base/jwt'];
214
+    const { email, name: nick } = getLocalParticipant(state);
215
+    const options = { ...config };
216
+
217
+    if (tenant) {
218
+        options.siteID = tenant;
219
+    }
220
+
221
+    if (options.enableDisplayNameInStats && nick) {
222
+        options.statisticsDisplayName = nick;
223
+    }
224
+
225
+    if (options.enableEmailInStats && email) {
226
+        options.statisticsId = email;
227
+    }
228
+
229
+    if (locationURL) {
230
+        options.confID = `${locationURL.host}${getBackendSafePath(locationURL.pathname)}`;
231
+    }
232
+
233
+    options.applicationName = getName();
234
+
235
+    // Disable analytics, if requessted.
236
+    if (options.disableThirdPartyRequests) {
237
+        delete config.analytics.scriptURLs;
238
+        delete config.analytics.amplitudeAPPKey;
239
+        delete config.analytics.googleAnalyticsTrackingId;
240
+        delete options.callStatsID;
241
+        delete options.callStatsSecret;
242
+    } else {
243
+        options.getWiFiStatsMethod = getWiFiStatsMethod;
244
+    }
245
+
246
+    return options;
247
+}
248
+
201 249
 /**
202 250
 * Returns the UTC timestamp when the first participant joined the conference.
203 251
 *
@@ -244,6 +292,21 @@ export function getRoomName(state: Object): string {
244 292
     return getConferenceState(state).room;
245 293
 }
246 294
 
295
+/**
296
+ * Returns the result of getWiFiStats from the global NS or does nothing
297
+ * (returns empty result).
298
+ * Fixes a concurrency problem where we need to pass a function when creating
299
+ * a JitsiConference, but that method is added to the context later.
300
+ *
301
+ * @returns {Promise}
302
+ * @private
303
+ */
304
+function getWiFiStatsMethod() {
305
+    const gloabalNS = getJitsiMeetGlobalNS();
306
+
307
+    return gloabalNS.getWiFiStats ? gloabalNS.getWiFiStats() : Promise.resolve('{}');
308
+}
309
+
247 310
 /**
248 311
  * Handle an error thrown by the backend (i.e. {@code lib-jitsi-meet}) while
249 312
  * manipulating a conference participant (e.g. Pin or select participant).

+ 0
- 65
react/features/conference/functions.web.js 查看文件

@@ -1,29 +1,9 @@
1
-import { getName } from '../app/functions.web';
2 1
 import { isSuboptimalBrowser } from '../base/environment';
3 2
 import { translateToHTML } from '../base/i18n';
4
-import { getLocalParticipant } from '../base/participants';
5
-import { toState } from '../base/redux';
6
-import { getBackendSafePath, getJitsiMeetGlobalNS } from '../base/util';
7 3
 import { showWarningNotification } from '../notifications';
8
-import { createRnnoiseProcessor } from '../stream-effects/rnnoise';
9 4
 
10 5
 export * from './functions.any';
11 6
 
12
-/**
13
- * Returns the result of getWiFiStats from the global NS or does nothing
14
-(returns empty result).
15
- * Fixes a concurrency problem where we need to pass a function when creating
16
- * a JitsiConference, but that method is added to the context later.
17
- *
18
- * @returns {Promise}
19
- * @private
20
- */
21
-const getWiFiStatsMethod = () => {
22
-    const gloabalNS = getJitsiMeetGlobalNS();
23
-
24
-    return gloabalNS.getWiFiStats ? gloabalNS.getWiFiStats() : Promise.resolve('{}');
25
-};
26
-
27 7
 /**
28 8
  * Shows the suboptimal experience notification if needed.
29 9
  *
@@ -49,48 +29,3 @@ export function maybeShowSuboptimalExperienceNotification(dispatch, t) {
49 29
         );
50 30
     }
51 31
 }
52
-
53
-/**
54
- * Returns an object aggregating the conference options.
55
- *
56
- * @param {Object|Function} stateful - The redux store state.
57
- * @returns {Object} - Options object.
58
- */
59
-export function getConferenceOptions(stateful) {
60
-    const state = toState(stateful);
61
-
62
-    const options = state['features/base/config'];
63
-    const { locationURL } = state['features/base/connection'];
64
-    const { tenant } = state['features/base/jwt'];
65
-
66
-    const { email, name: nick } = getLocalParticipant(state);
67
-
68
-    if (tenant) {
69
-        options.siteID = tenant;
70
-    }
71
-
72
-    if (options.enableDisplayNameInStats && nick) {
73
-        options.statisticsDisplayName = nick;
74
-    }
75
-
76
-    if (options.enableEmailInStats && email) {
77
-        options.statisticsId = email;
78
-    }
79
-
80
-    if (locationURL) {
81
-        options.confID = `${locationURL.host}${getBackendSafePath(locationURL.pathname)}`;
82
-    }
83
-
84
-    options.applicationName = getName();
85
-    options.getWiFiStatsMethod = getWiFiStatsMethod;
86
-    options.createVADProcessor = createRnnoiseProcessor;
87
-
88
-    // Disable CallStats, if requessted.
89
-    if (options.disableThirdPartyRequests) {
90
-        delete options.callStatsID;
91
-        delete options.callStatsSecret;
92
-        delete options.getWiFiStatsMethod;
93
-    }
94
-
95
-    return options;
96
-}

+ 1
- 1
react/features/prejoin/components/PrejoinApp.js 查看文件

@@ -5,10 +5,10 @@ import React from 'react';
5 5
 import { batch } from 'react-redux';
6 6
 
7 7
 import { BaseApp } from '../../../features/base/app';
8
+import { getConferenceOptions } from '../../base/conference/functions';
8 9
 import { setConfig } from '../../base/config';
9 10
 import { DialogContainer } from '../../base/dialog';
10 11
 import { createPrejoinTracks } from '../../base/tracks';
11
-import { getConferenceOptions } from '../../conference/functions';
12 12
 import { initPrejoin, makePrecallTest } from '../actions';
13 13
 
14 14
 import Prejoin from './Prejoin';

Loading…
取消
儲存