ソースを参照

[RN] Implement Labels on mobile

master
Bettenbuk Zoltan 7年前
コミット
4ac367d403

+ 0
- 8
react/features/conference/components/Conference.native.js ファイルの表示

@@ -20,7 +20,6 @@ import { LargeVideo } from '../../large-video';
20 20
 import { NotificationsContainer } from '../../notifications';
21 21
 import { setToolboxVisible, Toolbox } from '../../toolbox';
22 22
 
23
-import ConferenceIndicators from './ConferenceIndicators';
24 23
 import styles from './styles';
25 24
 
26 25
 /**
@@ -254,13 +253,6 @@ class Conference extends Component<Props> {
254 253
                       * participants.
255 254
                       */}
256 255
                     <Filmstrip />
257
-
258
-                    {/*
259
-                      * Examples of conference indicators are VideoQualityLabel
260
-                      * and RecordingLabel.
261
-                      */
262
-                        this.props._reducedUI || <ConferenceIndicators />
263
-                    }
264 256
                 </View>
265 257
                 <TestConnectionInfo />
266 258
 

+ 0
- 81
react/features/conference/components/ConferenceIndicators.native.js ファイルの表示

@@ -1,81 +0,0 @@
1
-// @flow
2
-import React, { Component } from 'react';
3
-import { View } from 'react-native';
4
-import { connect } from 'react-redux';
5
-
6
-import { JitsiRecordingConstants } from '../../base/lib-jitsi-meet';
7
-import {
8
-    isNarrowAspectRatio,
9
-    makeAspectRatioAware
10
-} from '../../base/responsive-ui';
11
-import { RecordingLabel } from '../../recording';
12
-import { VideoQualityLabel } from '../../video-quality';
13
-
14
-import styles from './styles';
15
-
16
-type Props = {
17
-
18
-    /**
19
-     * The indicator which determines whether the filmstrip is visible.
20
-     */
21
-    _filmstripVisible: boolean
22
-};
23
-
24
-/**
25
- * A container that renders the conference indicators, if any.
26
- */
27
-class ConferenceIndicators extends Component<Props> {
28
-    /**
29
-     * Implements React {@code Component}'s render.
30
-     *
31
-     * @inheritdoc
32
-     */
33
-    render() {
34
-        const _wide = !isNarrowAspectRatio(this);
35
-        const { _filmstripVisible } = this.props;
36
-
37
-        return (
38
-            <View
39
-                style = { [
40
-                    styles.indicatorContainer,
41
-                    _wide && _filmstripVisible && styles.indicatorContainerWide
42
-                ] }>
43
-                <RecordingLabel
44
-                    mode = { JitsiRecordingConstants.mode.FILE } />
45
-                <RecordingLabel
46
-                    mode = { JitsiRecordingConstants.mode.STREAM } />
47
-                <VideoQualityLabel />
48
-            </View>
49
-        );
50
-    }
51
-
52
-}
53
-
54
-/**
55
- * Maps (parts of) the redux state to the associated
56
- * {@code ConferenceIndicators}'s props.
57
- *
58
- * @param {Object} state - The redux state.
59
- * @private
60
- * @returns {{
61
- *     _filmstripVisible: boolean
62
- * }}
63
- */
64
-function _mapStateToProps(state) {
65
-    const { length: participantCount } = state['features/base/participants'];
66
-    const { visible } = state['features/filmstrip'];
67
-
68
-    return {
69
-        /**
70
-         * The indicator which determines whether the filmstrip is visible.
71
-         *
72
-         * @private
73
-         * @type {boolean}
74
-         */
75
-        _filmstripVisible: visible && participantCount > 1
76
-    };
77
-}
78
-
79
-export default connect(_mapStateToProps)(
80
-    makeAspectRatioAware(ConferenceIndicators)
81
-);

+ 0
- 0
react/features/conference/components/ConferenceIndicators.web.js ファイルの表示


+ 0
- 19
react/features/conference/components/styles.js ファイルの表示

@@ -18,25 +18,6 @@ export default createStyleSheet({
18 18
         flex: 1
19 19
     }),
20 20
 
21
-    /**
22
-     * View that contains the indicators.
23
-     */
24
-    indicatorContainer: {
25
-        flex: 1,
26
-        flexDirection: 'row',
27
-        margin: BoxModel.margin,
28
-        position: 'absolute',
29
-        right: 0,
30
-        top: 0
31
-    },
32
-
33
-    /**
34
-     * Indicator container for wide aspect ratio.
35
-     */
36
-    indicatorContainerWide: {
37
-        right: 80
38
-    },
39
-
40 21
     /**
41 22
      * The style of the {@link View} which expands over the whole
42 23
      * {@link Conference} area and splits it between the {@link Filmstrip} and

+ 69
- 0
react/features/large-video/components/AbstractLabels.js ファイルの表示

@@ -0,0 +1,69 @@
1
+// @flow
2
+
3
+import React, { Component } from 'react';
4
+
5
+import { isFilmstripVisible } from '../../filmstrip';
6
+import { RecordingLabel } from '../../recording';
7
+import { VideoQualityLabel } from '../../video-quality';
8
+
9
+/**
10
+ * The type of the React {@code Component} props of {@link AbstractLabels}.
11
+ */
12
+export type Props = {
13
+
14
+    /**
15
+    * Whether or not the filmstrip is displayed with remote videos. Used to
16
+    * determine display classes to set.
17
+    */
18
+    _filmstripVisible: boolean,
19
+};
20
+
21
+/**
22
+ * A container to hold video status labels, including recording status and
23
+ * current large video quality.
24
+ *
25
+ * @extends Component
26
+ */
27
+export default class AbstractLabels<P: Props, S> extends Component<P, S> {
28
+    /**
29
+     * Renders the {@code RecordingLabel} that is platform independent.
30
+     *
31
+     * @protected
32
+     * @param {string} mode - The recording mode that this label is rendered
33
+     * for.
34
+     * @returns {React$Element}
35
+     */
36
+    _renderRecordingLabel(mode: string) {
37
+        return (
38
+            <RecordingLabel mode = { mode } />
39
+        );
40
+    }
41
+
42
+    /**
43
+     * Renders the {@code VideoQualityLabel} that is platform independent.
44
+     *
45
+     * @protected
46
+     * @returns {React$Element}
47
+     */
48
+    _renderVideoQualityLabel() {
49
+        return (
50
+            <VideoQualityLabel />
51
+        );
52
+    }
53
+}
54
+
55
+/**
56
+ * Maps (parts of) the Redux state to the associated props for the
57
+ * {@code Labels} component.
58
+ *
59
+ * @param {Object} state - The Redux state.
60
+ * @private
61
+ * @returns {{
62
+ *     _filmstripVisible: boolean
63
+ * }}
64
+ */
65
+export function _abstractMapStateToProps(state: Object) {
66
+    return {
67
+        _filmstripVisible: isFilmstripVisible(state)
68
+    };
69
+}

+ 81
- 0
react/features/large-video/components/Labels.native.js ファイルの表示

@@ -0,0 +1,81 @@
1
+// @flow
2
+import React from 'react';
3
+import { View } from 'react-native';
4
+import { connect } from 'react-redux';
5
+
6
+import { JitsiRecordingConstants } from '../../base/lib-jitsi-meet';
7
+import {
8
+    isNarrowAspectRatio,
9
+    makeAspectRatioAware
10
+} from '../../base/responsive-ui';
11
+import { isFilmstripVisible } from '../../filmstrip';
12
+
13
+import AbstractLabels, { type Props } from './AbstractLabels';
14
+import styles from './styles';
15
+
16
+/**
17
+ * A container that renders the conference indicators, if any.
18
+ */
19
+class Labels extends AbstractLabels<Props, *> {
20
+    /**
21
+     * Implements React {@code Component}'s render.
22
+     *
23
+     * @inheritdoc
24
+     */
25
+    render() {
26
+        const _wide = !isNarrowAspectRatio(this);
27
+        const { _filmstripVisible } = this.props;
28
+
29
+        return (
30
+            <View
31
+                pointerEvents = 'box-none'
32
+                style = { [
33
+                    styles.indicatorContainer,
34
+                    _wide && _filmstripVisible && styles.indicatorContainerWide
35
+                ] }>
36
+                {
37
+                    this._renderRecordingLabel(
38
+                        JitsiRecordingConstants.mode.FILE)
39
+                }
40
+                {
41
+                    this._renderRecordingLabel(
42
+                        JitsiRecordingConstants.mode.STREAM)
43
+                }
44
+                {
45
+                    this._renderVideoQualityLabel()
46
+                }
47
+            </View>
48
+        );
49
+    }
50
+
51
+    _renderRecordingLabel: string => React$Element<*>
52
+
53
+    _renderVideoQualityLabel: () => React$Element<*>
54
+
55
+}
56
+
57
+/**
58
+ * Maps (parts of) the redux state to the associated
59
+ * {@code Labels}'s props.
60
+ *
61
+ * @param {Object} state - The redux state.
62
+ * @private
63
+ * @returns {{
64
+ *     _filmstripVisible: boolean
65
+ * }}
66
+ */
67
+function _mapStateToProps(state) {
68
+    return {
69
+        /**
70
+         * The indicator which determines whether the filmstrip is visible.
71
+         *
72
+         * @private
73
+         * @type {boolean}
74
+         */
75
+        _filmstripVisible: isFilmstripVisible(state)
76
+    };
77
+}
78
+
79
+export default connect(_mapStateToProps)(
80
+    makeAspectRatioAware(Labels)
81
+);

+ 21
- 60
react/features/large-video/components/Labels.web.js ファイルの表示

@@ -1,28 +1,14 @@
1 1
 // @flow
2 2
 
3
-import React, { Component } from 'react';
3
+import React from 'react';
4 4
 import { connect } from 'react-redux';
5 5
 
6
-import { RecordingLabel } from '../../recording';
7
-import { VideoQualityLabel } from '../../video-quality';
8
-
9
-/**
10
- * The type of the React {@code Component} props of {@link Labels}.
11
- */
12
-type Props = {
13
-
14
-    /**
15
-    * Whether or not the filmstrip is displayed with remote videos. Used to
16
-    * determine display classes to set.
17
-    */
18
-    _filmstripVisible: boolean,
6
+import { JitsiRecordingConstants } from '../../base/lib-jitsi-meet';
19 7
 
20
-
21
-    /**
22
-     * The redux state for all known recording sessions.
23
-     */
24
-    _recordingSessions: Array<Object>
25
-};
8
+import AbstractLabels, {
9
+    _abstractMapStateToProps as _mapStateToProps,
10
+    type Props
11
+} from './AbstractLabels';
26 12
 
27 13
 /**
28 14
  * The type of the React {@code Component} state of {@link Labels}.
@@ -45,7 +31,7 @@ type State = {
45 31
  *
46 32
  * @extends Component
47 33
  */
48
-class Labels extends Component<Props, State> {
34
+class Labels extends AbstractLabels<Props, State> {
49 35
     /**
50 36
      * Initializes a new {@code Labels} instance.
51 37
      *
@@ -58,9 +44,6 @@ class Labels extends Component<Props, State> {
58 44
         this.state = {
59 45
             filmstripBecomingVisible: false
60 46
         };
61
-
62
-        // Bind event handler so it is only bound once for every instance.
63
-        this._renderRecordingLabel = this._renderRecordingLabel.bind(this);
64 47
     }
65 48
 
66 49
     /**
@@ -86,7 +69,7 @@ class Labels extends Component<Props, State> {
86 69
      * @returns {ReactElement}
87 70
      */
88 71
     render() {
89
-        const { _filmstripVisible, _recordingSessions } = this.props;
72
+        const { _filmstripVisible } = this.props;
90 73
         const { filmstripBecomingVisible } = this.state;
91 74
         const className = `large-video-labels ${
92 75
             filmstripBecomingVisible ? 'opening' : ''} ${
@@ -94,46 +77,24 @@ class Labels extends Component<Props, State> {
94 77
 
95 78
         return (
96 79
             <div className = { className } >
97
-                { _recordingSessions.map(this._renderRecordingLabel) }
98
-                <VideoQualityLabel />
80
+                {
81
+                    this._renderRecordingLabel(
82
+                        JitsiRecordingConstants.mode.FILE)
83
+                }
84
+                {
85
+                    this._renderRecordingLabel(
86
+                        JitsiRecordingConstants.mode.STREAM)
87
+                }
88
+                {
89
+                    this._renderVideoQualityLabel()
90
+                }
99 91
             </div>
100 92
         );
101 93
     }
102 94
 
103
-    _renderRecordingLabel: (Object) => React$Node;
95
+    _renderRecordingLabel: string => React$Element<*>
104 96
 
105
-    /**
106
-     * Renders a recording label.
107
-     *
108
-     * @param {Object} recordingSession - The recording session to render.
109
-     * @private
110
-     * @returns {ReactElement}
111
-     */
112
-    _renderRecordingLabel(recordingSession) {
113
-        return (
114
-            <RecordingLabel
115
-                key = { recordingSession.id }
116
-                session = { recordingSession } />
117
-        );
118
-    }
119
-}
120
-
121
-/**
122
- * Maps (parts of) the Redux state to the associated props for the
123
- * {@code Labels} component.
124
- *
125
- * @param {Object} state - The Redux state.
126
- * @private
127
- * @returns {{
128
- *     _filmstripVisible: boolean,
129
- *     _recordingSessions: Array<Object>
130
- * }}
131
- */
132
-function _mapStateToProps(state) {
133
-    return {
134
-        _filmstripVisible: state['features/filmstrip'].visible,
135
-        _recordingSessions: state['features/recording'].sessionDatas
136
-    };
97
+    _renderVideoQualityLabel: () => React$Element<*>
137 98
 }
138 99
 
139 100
 export default connect(_mapStateToProps)(Labels);

+ 2
- 0
react/features/large-video/components/LargeVideo.native.js ファイルの表示

@@ -6,6 +6,7 @@ import { connect } from 'react-redux';
6 6
 import { ParticipantView } from '../../base/participants';
7 7
 import { DimensionsDetector } from '../../base/responsive-ui';
8 8
 
9
+import Labels from './Labels';
9 10
 import styles, { AVATAR_SIZE } from './styles';
10 11
 
11 12
 /**
@@ -129,6 +130,7 @@ class LargeVideo extends Component<Props, State> {
129 130
                     useConnectivityInfoLabel = { useConnectivityInfoLabel }
130 131
                     zOrder = { 0 }
131 132
                     zoomEnabled = { true } />
133
+                <Labels />
132 134
             </DimensionsDetector>
133 135
         );
134 136
     }

+ 25
- 1
react/features/large-video/components/styles.js ファイルの表示

@@ -1,6 +1,7 @@
1 1
 import { StyleSheet } from 'react-native';
2 2
 
3
-import { ColorPalette, createStyleSheet } from '../../base/styles';
3
+import { BoxModel, ColorPalette, createStyleSheet } from '../../base/styles';
4
+import { FILMSTRIP_SIZE } from '../../filmstrip';
4 5
 
5 6
 /**
6 7
  * Size for the Avatar.
@@ -8,6 +9,29 @@ import { ColorPalette, createStyleSheet } from '../../base/styles';
8 9
 export const AVATAR_SIZE = 200;
9 10
 
10 11
 export default createStyleSheet({
12
+    /**
13
+     * View that contains the indicators.
14
+     */
15
+    indicatorContainer: {
16
+        flex: 1,
17
+        flexDirection: 'row',
18
+        margin: BoxModel.margin,
19
+        position: 'absolute',
20
+        right: 0,
21
+
22
+        // Both on Android and iOS there is the status bar which may be visible.
23
+        // On iPhone X there is the notch. In the two cases BoxModel.margin is
24
+        // not enough.
25
+        top: BoxModel.margin * 3
26
+    },
27
+
28
+    /**
29
+     * Indicator container for wide aspect ratio.
30
+     */
31
+    indicatorContainerWide: {
32
+        right: FILMSTRIP_SIZE
33
+    },
34
+
11 35
     /**
12 36
      * Large video container style.
13 37
      */

読み込み中…
キャンセル
保存