Explorar el Código

ref(Conference): extract AbstractConference

master
paweldomas hace 6 años
padre
commit
15fd27543a

+ 40
- 0
react/features/conference/components/AbstractConference.js Ver fichero

@@ -0,0 +1,40 @@
1
+// @flow
2
+
3
+import { shouldDisplayTileView } from '../../video-layout';
4
+
5
+/**
6
+ * The type of the React {@code Component} props of {@link AbstractLabels}.
7
+ */
8
+export type AbstractProps = {
9
+
10
+    /**
11
+     * Conference room name.
12
+     *
13
+     * @protected
14
+     * @type {string}
15
+     */
16
+    _room: string,
17
+
18
+    /**
19
+     * Whether or not the layout should change to support tile view mode.
20
+     *
21
+     * @protected
22
+     * @type {boolean}
23
+     */
24
+    _shouldDisplayTileView: boolean
25
+};
26
+
27
+/**
28
+ * Maps (parts of) the redux state to the associated props of the {@link Labels}
29
+ * {@code Component}.
30
+ *
31
+ * @param {Object} state - The redux state.
32
+ * @private
33
+ * @returns {AbstractProps}
34
+ */
35
+export function abstractMapStateToProps(state: Object) {
36
+    return {
37
+        _room: state['features/base/conference'].room,
38
+        _shouldDisplayTileView: shouldDisplayTileView(state)
39
+    };
40
+}

+ 8
- 44
react/features/conference/components/native/Conference.js Ver fichero

@@ -25,17 +25,19 @@ import { LargeVideo } from '../../../large-video';
25 25
 import { AddPeopleDialog, CalleeInfoContainer } from '../../../invite';
26 26
 import { Captions } from '../../../subtitles';
27 27
 import { setToolboxVisible, Toolbox } from '../../../toolbox';
28
-import { shouldDisplayTileView } from '../../../video-layout';
29 28
 
29
+import { abstractMapStateToProps } from '../AbstractConference';
30 30
 import DisplayNameLabel from './DisplayNameLabel';
31 31
 import Labels from './Labels';
32 32
 import NavigationBar from './NavigationBar';
33 33
 import styles from './styles';
34 34
 
35
+import type { AbstractProps } from '../AbstractConference';
36
+
35 37
 /**
36 38
  * The type of the React {@code Component} props of {@link Conference}.
37 39
  */
38
-type Props = {
40
+type Props = AbstractProps & {
39 41
 
40 42
     /**
41 43
      * The indicator which determines that we are still connecting to the
@@ -103,13 +105,6 @@ type Props = {
103 105
      */
104 106
     _reducedUI: boolean,
105 107
 
106
-    /**
107
-     * The current conference room name.
108
-     *
109
-     * @private
110
-     */
111
-    _room: string,
112
-
113 108
     /**
114 109
      * The handler which dispatches the (redux) action {@link setToolboxVisible}
115 110
      * to show/hide the {@link Toolbox}.
@@ -121,13 +116,6 @@ type Props = {
121 116
      */
122 117
     _setToolboxVisible: Function,
123 118
 
124
-    /**
125
-     * Whether or not the layout should change to support tile view mode.
126
-     *
127
-     * @private
128
-     */
129
-    _shouldDisplayTileView: boolean,
130
-
131 119
     /**
132 120
      * The indicator which determines whether the Toolbox is visible.
133 121
      *
@@ -424,16 +412,7 @@ function _mapDispatchToProps(dispatch) {
424 412
  *
425 413
  * @param {Object} state - The redux state.
426 414
  * @private
427
- * @returns {{
428
- *     _connecting: boolean,
429
- *     _filmstripVisible: boolean,
430
- *     _locationURL: URL,
431
- *     _participantCount: number,
432
- *     _reducedUI: boolean,
433
- *     _room: string,
434
- *     _toolboxVisible: boolean,
435
- *     _toolboxAlwaysVisible: boolean
436
- * }}
415
+ * @returns {Props}
437 416
  */
438 417
 function _mapStateToProps(state) {
439 418
     const { connecting, connection, locationURL }
@@ -441,8 +420,7 @@ function _mapStateToProps(state) {
441 420
     const {
442 421
         conference,
443 422
         joining,
444
-        leaving,
445
-        room
423
+        leaving
446 424
     } = state['features/base/conference'];
447 425
     const { reducedUI } = state['features/base/responsive-ui'];
448 426
     const { alwaysVisible, visible } = state['features/toolbox'];
@@ -460,6 +438,8 @@ function _mapStateToProps(state) {
460 438
         = connecting || (connection && (joining || (!conference && !leaving)));
461 439
 
462 440
     return {
441
+        ...abstractMapStateToProps(state),
442
+
463 443
         /**
464 444
          * The indicator which determines that we are still connecting to the
465 445
          * conference which includes establishing the XMPP connection and then
@@ -501,22 +481,6 @@ function _mapStateToProps(state) {
501 481
          */
502 482
         _reducedUI: reducedUI,
503 483
 
504
-        /**
505
-         * The current conference room name.
506
-         *
507
-         * @private
508
-         * @type {string}
509
-         */
510
-        _room: room,
511
-
512
-        /**
513
-         * Whether or not the layout should change to support tile view mode.
514
-         *
515
-         * @private
516
-         * @type {boolean}
517
-         */
518
-        _shouldDisplayTileView: shouldDisplayTileView(state),
519
-
520 484
         /**
521 485
          * The indicator which determines whether the Toolbox is visible.
522 486
          *

+ 8
- 25
react/features/conference/components/web/Conference.js Ver fichero

@@ -14,11 +14,7 @@ import { Filmstrip } from '../../../filmstrip';
14 14
 import { CalleeInfoContainer } from '../../../invite';
15 15
 import { LargeVideo } from '../../../large-video';
16 16
 import { NotificationsContainer } from '../../../notifications';
17
-import {
18
-    LAYOUTS,
19
-    getCurrentLayout,
20
-    shouldDisplayTileView
21
-} from '../../../video-layout';
17
+import { LAYOUTS, getCurrentLayout } from '../../../video-layout';
22 18
 
23 19
 import {
24 20
     Toolbox,
@@ -32,6 +28,9 @@ import { maybeShowSuboptimalExperienceNotification } from '../../functions';
32 28
 import Labels from './Labels';
33 29
 import { default as Notice } from './Notice';
34 30
 import { default as Subject } from './Subject';
31
+import { abstractMapStateToProps } from '../AbstractConference';
32
+
33
+import type { AbstractProps } from '../AbstractConference';
35 34
 
36 35
 declare var APP: Object;
37 36
 declare var config: Object;
@@ -68,7 +67,7 @@ const LAYOUT_CLASSNAMES = {
68 67
 /**
69 68
  * The type of the React {@code Component} props of {@link Conference}.
70 69
  */
71
-type Props = {
70
+type Props = AbstractProps & {
72 71
 
73 72
     /**
74 73
      * Whether the local participant is recording the conference.
@@ -81,16 +80,6 @@ type Props = {
81 80
      */
82 81
     _layoutClassName: string,
83 82
 
84
-    /**
85
-     * Conference room name.
86
-     */
87
-    _room: string,
88
-
89
-    /**
90
-     * Whether or not the current UI layout should be in tile view.
91
-     */
92
-    _shouldDisplayTileView: boolean,
93
-
94 83
     dispatch: Function,
95 84
     t: Function
96 85
 }
@@ -290,21 +279,15 @@ class Conference extends Component<Props> {
290 279
  *
291 280
  * @param {Object} state - The Redux state.
292 281
  * @private
293
- * @returns {{
294
- *     _iAmRecorder: boolean,
295
- *     _layoutClassName: string,
296
- *     _room: ?string,
297
- *     _shouldDisplayTileView: boolean
298
- * }}
282
+ * @returns {Props}
299 283
  */
300 284
 function _mapStateToProps(state) {
301 285
     const currentLayout = getCurrentLayout(state);
302 286
 
303 287
     return {
288
+        ...abstractMapStateToProps(state),
304 289
         _iAmRecorder: state['features/base/config'].iAmRecorder,
305
-        _layoutClassName: LAYOUT_CLASSNAMES[currentLayout],
306
-        _room: state['features/base/conference'].room,
307
-        _shouldDisplayTileView: shouldDisplayTileView(state)
290
+        _layoutClassName: LAYOUT_CLASSNAMES[currentLayout]
308 291
     };
309 292
 }
310 293
 

Loading…
Cancelar
Guardar