Browse Source

feat(prejoin) show connection status in exported prejoin screen

master
Tudor-Ovidiu Avram 4 years ago
parent
commit
6d2f8ae37d

+ 2
- 52
conference.js View File

@@ -104,11 +104,8 @@ import {
104 104
     trackAdded,
105 105
     trackRemoved
106 106
 } from './react/features/base/tracks';
107
-import {
108
-    getBackendSafePath,
109
-    getJitsiMeetGlobalNS
110
-} from './react/features/base/util';
111 107
 import { downloadJSON } from './react/features/base/util/downloadJSON';
108
+import { getConferenceOptions } from './react/features/conference/functions';
112 109
 import { showDesktopPicker } from './react/features/desktop-picker';
113 110
 import { appendSuffix } from './react/features/display-name';
114 111
 import {
@@ -124,7 +121,6 @@ import {
124 121
     isPrejoinPageVisible,
125 122
     makePrecallTest
126 123
 } from './react/features/prejoin';
127
-import { createRnnoiseProcessorPromise } from './react/features/rnnoise';
128 124
 import { toggleScreenshotCaptureEffect } from './react/features/screenshot-capture';
129 125
 import { setSharedVideoStatus } from './react/features/shared-video';
130 126
 import { AudioMixerEffect } from './react/features/stream-effects/audio-mixer/AudioMixerEffect';
@@ -1319,53 +1315,7 @@ export default {
1319 1315
     },
1320 1316
 
1321 1317
     _getConferenceOptions() {
1322
-        const options = config;
1323
-        const { email, name: nick } = getLocalParticipant(APP.store.getState());
1324
-
1325
-        const state = APP.store.getState();
1326
-        const { locationURL } = state['features/base/connection'];
1327
-        const { tenant } = state['features/base/jwt'];
1328
-
1329
-        if (tenant) {
1330
-            options.siteID = tenant;
1331
-        }
1332
-
1333
-        if (options.enableDisplayNameInStats && nick) {
1334
-            options.statisticsDisplayName = nick;
1335
-        }
1336
-
1337
-        if (options.enableEmailInStats && email) {
1338
-            options.statisticsId = email;
1339
-        }
1340
-
1341
-        options.applicationName = interfaceConfig.APP_NAME;
1342
-        options.getWiFiStatsMethod = this._getWiFiStatsMethod;
1343
-        options.confID = `${locationURL.host}${getBackendSafePath(locationURL.pathname)}`;
1344
-        options.createVADProcessor = createRnnoiseProcessorPromise;
1345
-
1346
-        // Disable CallStats, if requessted.
1347
-        if (options.disableThirdPartyRequests) {
1348
-            delete options.callStatsID;
1349
-            delete options.callStatsSecret;
1350
-            delete options.getWiFiStatsMethod;
1351
-        }
1352
-
1353
-        return options;
1354
-    },
1355
-
1356
-    /**
1357
-     * Returns the result of getWiFiStats from the global NS or does nothing
1358
-     * (returns empty result).
1359
-     * Fixes a concurrency problem where we need to pass a function when creating
1360
-     * JitsiConference, but that method is added to the context later.
1361
-     *
1362
-     * @returns {Promise}
1363
-     * @private
1364
-     */
1365
-    _getWiFiStatsMethod() {
1366
-        const gloabalNS = getJitsiMeetGlobalNS();
1367
-
1368
-        return gloabalNS.getWiFiStats ? gloabalNS.getWiFiStats() : Promise.resolve('{}');
1318
+        return getConferenceOptions(APP.store.getState());
1369 1319
     },
1370 1320
 
1371 1321
     /**

+ 10
- 3
flow-typed/npm/react-redux_v7.x.x.js View File

@@ -1,5 +1,5 @@
1
-// flow-typed signature: d2ddacbbca9700881249a9435381e689
2
-// flow-typed version: c6154227d1/react-redux_v7.x.x/flow_>=v0.89.x <=v0.103.x
1
+// flow-typed signature: 8da1e134b3de1d6f6bf9ba1cc7e2dc7e
2
+// flow-typed version: 387a235736/react-redux_v7.x.x/flow_>=v0.104.x
3 3
 
4 4
 /**
5 5
 The order of type arguments for connect() is as follows:
@@ -219,6 +219,7 @@ declare module "react-redux" {
219 219
   declare export class Provider<Store> extends React$Component<{
220 220
     store: Store,
221 221
     children?: React$Node,
222
+    ...
222 223
   }> {}
223 224
 
224 225
   declare export function createProvider(
@@ -237,6 +238,7 @@ declare module "react-redux" {
237 238
     shouldHandleStateChanges?: boolean,
238 239
     storeKey?: string,
239 240
     forwardRef?: boolean,
241
+    ...
240 242
   };
241 243
 
242 244
   declare type SelectorFactoryOptions<Com> = {
@@ -249,6 +251,7 @@ declare module "react-redux" {
249 251
     displayName: string,
250 252
     wrappedComponentName: string,
251 253
     WrappedComponent: Com,
254
+    ...
252 255
   };
253 256
 
254 257
   declare type MapStateToPropsEx<S: Object, SP: Object, RSP: Object> = (
@@ -275,12 +278,14 @@ declare module "react-redux" {
275 278
     OP: Object,
276 279
     CP: Object,
277 280
     EFO: Object,
278
-    ST: { [_: $Keys<Com>]: any },
281
+    ST: { [_: $Keys<Com>]: any, ... },
279 282
   >(
280 283
     selectorFactory: SelectorFactory<Com, D, S, OP, EFO, CP>,
281 284
     connectAdvancedOptions: ?(ConnectAdvancedOptions & EFO),
282 285
   ): (component: Com) => React$ComponentType<OP> & $Shape<ST>;
283 286
 
287
+  declare export function batch(() => void): void
288
+
284 289
   declare export default {
285 290
     Provider: typeof Provider,
286 291
     createProvider: typeof createProvider,
@@ -289,5 +294,7 @@ declare module "react-redux" {
289 294
     useDispatch: typeof useDispatch,
290 295
     useSelector: typeof useSelector,
291 296
     useStore: typeof useStore,
297
+    batch: typeof batch,
298
+    ...
292 299
   };
293 300
 }

+ 0
- 51
react/features/conference/functions.js View File

@@ -1,51 +0,0 @@
1
-import { isSuboptimalBrowser } from '../base/environment';
2
-import { translateToHTML } from '../base/i18n';
3
-import { toState } from '../base/redux';
4
-import {
5
-    areThereNotifications,
6
-    showWarningNotification
7
-} from '../notifications';
8
-import { getOverlayToRender } from '../overlay';
9
-
10
-/**
11
- * Shows the suboptimal experience notification if needed.
12
- *
13
- * @param {Function} dispatch - The dispatch method.
14
- * @param {Function} t - The translation function.
15
- * @returns {void}
16
- */
17
-export function maybeShowSuboptimalExperienceNotification(dispatch, t) {
18
-    if (isSuboptimalBrowser()) {
19
-        dispatch(
20
-            showWarningNotification(
21
-                {
22
-                    titleKey: 'notify.suboptimalExperienceTitle',
23
-                    description: translateToHTML(
24
-                        t,
25
-                        'notify.suboptimalBrowserWarning',
26
-                        {
27
-                            recommendedBrowserPageLink: `${window.location.origin}/static/recommendedBrowsers.html`
28
-                        }
29
-                    )
30
-                }
31
-            )
32
-        );
33
-    }
34
-}
35
-
36
-/**
37
- * Tells whether or not the notifications should be displayed within
38
- * the conference feature based on the current Redux state.
39
- *
40
- * @param {Object|Function} stateful - The redux store state.
41
- * @returns {boolean}
42
- */
43
-export function shouldDisplayNotifications(stateful) {
44
-    const state = toState(stateful);
45
-    const isAnyOverlayVisible = Boolean(getOverlayToRender(state));
46
-    const { calleeInfoVisible } = state['features/invite'];
47
-
48
-    return areThereNotifications(state)
49
-            && !isAnyOverlayVisible
50
-            && !calleeInfoVisible;
51
-}

+ 0
- 0
react/features/conference/functions.native.js View File


+ 112
- 0
react/features/conference/functions.web.js View File

@@ -0,0 +1,112 @@
1
+import { getName } from '../app/functions.web';
2
+import { isSuboptimalBrowser } from '../base/environment';
3
+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
+import {
8
+    areThereNotifications,
9
+    showWarningNotification
10
+} from '../notifications';
11
+import { getOverlayToRender } from '../overlay';
12
+import { createRnnoiseProcessorPromise } from '../rnnoise';
13
+
14
+/**
15
+ * Returns the result of getWiFiStats from the global NS or does nothing
16
+(returns empty result).
17
+ * Fixes a concurrency problem where we need to pass a function when creating
18
+ * a JitsiConference, but that method is added to the context later.
19
+ *
20
+ * @returns {Promise}
21
+ * @private
22
+ */
23
+const getWiFiStatsMethod = () => {
24
+    const gloabalNS = getJitsiMeetGlobalNS();
25
+
26
+    return gloabalNS.getWiFiStats ? gloabalNS.getWiFiStats() : Promise.resolve('{}');
27
+};
28
+
29
+/**
30
+ * Shows the suboptimal experience notification if needed.
31
+ *
32
+ * @param {Function} dispatch - The dispatch method.
33
+ * @param {Function} t - The translation function.
34
+ * @returns {void}
35
+ */
36
+export function maybeShowSuboptimalExperienceNotification(dispatch, t) {
37
+    if (isSuboptimalBrowser()) {
38
+        dispatch(
39
+            showWarningNotification(
40
+                {
41
+                    titleKey: 'notify.suboptimalExperienceTitle',
42
+                    description: translateToHTML(
43
+                        t,
44
+                        'notify.suboptimalBrowserWarning',
45
+                        {
46
+                            recommendedBrowserPageLink: `${window.location.origin}/static/recommendedBrowsers.html`
47
+                        }
48
+                    )
49
+                }
50
+            )
51
+        );
52
+    }
53
+}
54
+
55
+/**
56
+ * Tells whether or not the notifications should be displayed within
57
+ * the conference feature based on the current Redux state.
58
+ *
59
+ * @param {Object|Function} stateful - The redux store state.
60
+ * @returns {boolean}
61
+ */
62
+export function shouldDisplayNotifications(stateful) {
63
+    const state = toState(stateful);
64
+    const isAnyOverlayVisible = Boolean(getOverlayToRender(state));
65
+    const { calleeInfoVisible } = state['features/invite'];
66
+
67
+    return areThereNotifications(state)
68
+            && !isAnyOverlayVisible
69
+            && !calleeInfoVisible;
70
+}
71
+
72
+/**
73
+ * Returns an object aggregating the conference options.
74
+ *
75
+ * @param {Object|Function} stateful - The redux store state.
76
+ * @returns {Object} - Options object.
77
+ */
78
+export function getConferenceOptions(stateful) {
79
+    const state = toState(stateful);
80
+
81
+    const options = state['features/base/config'];
82
+    const { locationURL } = state['features/base/connection'];
83
+    const { tenant } = state['features/base/jwt'];
84
+
85
+    const { email, name: nick } = getLocalParticipant(state);
86
+
87
+    if (tenant) {
88
+        options.siteID = tenant;
89
+    }
90
+
91
+    if (options.enableDisplayNameInStats && nick) {
92
+        options.statisticsDisplayName = nick;
93
+    }
94
+
95
+    if (options.enableEmailInStats && email) {
96
+        options.statisticsId = email;
97
+    }
98
+
99
+    options.applicationName = getName();
100
+    options.getWiFiStatsMethod = getWiFiStatsMethod;
101
+    options.confID = `${locationURL.host}${getBackendSafePath(locationURL.pathname)}`;
102
+    options.createVADProcessor = createRnnoiseProcessorPromise;
103
+
104
+    // Disable CallStats, if requessted.
105
+    if (options.disableThirdPartyRequests) {
106
+        delete options.callStatsID;
107
+        delete options.callStatsSecret;
108
+        delete options.getWiFiStatsMethod;
109
+    }
110
+
111
+    return options;
112
+}

+ 7
- 2
react/features/prejoin/components/PrejoinApp.js View File

@@ -2,11 +2,13 @@
2 2
 
3 3
 import { AtlasKitThemeProvider } from '@atlaskit/theme';
4 4
 import React from 'react';
5
+import { batch } from 'react-redux';
5 6
 
6 7
 import { BaseApp } from '../../../features/base/app';
7 8
 import { setConfig } from '../../base/config';
8 9
 import { createPrejoinTracks } from '../../base/tracks';
9
-import { initPrejoin } from '../actions';
10
+import { getConferenceOptions } from '../../conference/functions';
11
+import { initPrejoin, makePrecallTest } from '../actions';
10 12
 
11 13
 import Prejoin from './Prejoin';
12 14
 
@@ -70,7 +72,10 @@ export default class PrejoinApp extends BaseApp<Props> {
70 72
 
71 73
             const tracks = await tryCreateLocalTracks;
72 74
 
73
-            dispatch(initPrejoin(tracks, errors));
75
+            batch(() => {
76
+                dispatch(initPrejoin(tracks, errors));
77
+                dispatch(makePrecallTest(getConferenceOptions(store.getState())));
78
+            });
74 79
         });
75 80
     }
76 81
 

Loading…
Cancel
Save