瀏覽代碼

[RN] Add indicator container

master
Bettenbuk Zoltan 7 年之前
父節點
當前提交
d15753f719

+ 6
- 10
react/features/conference/components/Conference.native.js 查看文件

@@ -10,7 +10,6 @@ import { appNavigate } from '../../app';
10 10
 import { connect, disconnect } from '../../base/connection';
11 11
 import { DialogContainer } from '../../base/dialog';
12 12
 import { CalleeInfoContainer } from '../../base/jwt';
13
-import { JitsiRecordingConstants } from '../../base/lib-jitsi-meet';
14 13
 import { getParticipantCount } from '../../base/participants';
15 14
 import { Container, LoadingIndicator, TintedView } from '../../base/react';
16 15
 import { TestConnectionInfo } from '../../base/testing';
@@ -18,10 +17,9 @@ import { createDesiredLocalTracks } from '../../base/tracks';
18 17
 import { ConferenceNotification } from '../../calendar-sync';
19 18
 import { Filmstrip } from '../../filmstrip';
20 19
 import { LargeVideo } from '../../large-video';
21
-import { RecordingLabel } from '../../recording';
22 20
 import { setToolboxVisible, Toolbox } from '../../toolbox';
23
-import { VideoQualityLabel } from '../../video-quality';
24 21
 
22
+import ConferenceIndicators from './ConferenceIndicators';
25 23
 import styles from './styles';
26 24
 
27 25
 /**
@@ -249,13 +247,11 @@ class Conference extends Component<Props> {
249 247
                       */}
250 248
                     <Filmstrip />
251 249
 
252
-                    <View style = { styles.indicatorContainer }>
253
-                        <RecordingLabel
254
-                            mode = { JitsiRecordingConstants.mode.FILE } />
255
-                        <RecordingLabel
256
-                            mode = { JitsiRecordingConstants.mode.STREAM } />
257
-                        <VideoQualityLabel />
258
-                    </View>
250
+                    {/*
251
+                      * A container that automatically renders indicators such
252
+                      * as VideoQualityLabel or RecordingLabel if need be.
253
+                      */}
254
+                    <ConferenceIndicators />
259 255
                 </View>
260 256
                 <TestConnectionInfo />
261 257
 

+ 81
- 0
react/features/conference/components/ConferenceIndicators.native.js 查看文件

@@ -0,0 +1,81 @@
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 查看文件


+ 7
- 0
react/features/conference/components/styles.js 查看文件

@@ -30,6 +30,13 @@ export default createStyleSheet({
30 30
         top: 0
31 31
     },
32 32
 
33
+    /**
34
+     * Indicator container for wide aspect ratio.
35
+     */
36
+    indicatorContainerWide: {
37
+        right: 80
38
+    },
39
+
33 40
     /**
34 41
      * The style of the {@link View} which expands over the whole
35 42
      * {@link Conference} area and splits it between the {@link Filmstrip} and

Loading…
取消
儲存