瀏覽代碼

task(rn): hide screen share button when audioOnly mode

master
tmoldovan8x8 4 年之前
父節點
當前提交
06110d1dfb
沒有連結到貢獻者的電子郵件帳戶。

+ 15
- 1
react/features/toolbox/components/native/ScreenSharingAndroidButton.js 查看文件

@@ -11,6 +11,11 @@ import { toggleScreensharing, isLocalVideoTrackDesktop } from '../../../base/tra
11 11
  */
12 12
 type Props = AbstractButtonProps & {
13 13
 
14
+    /**
15
+     * True if the button needs to be disabled.
16
+     */
17
+    _disabled: boolean,
18
+
14 19
     /**
15 20
      * Whether video is currently muted or not.
16 21
      */
@@ -44,6 +49,16 @@ class ScreenSharingAndroidButton extends AbstractButton<Props, *> {
44 49
         this.props.dispatch(toggleScreensharing(enable));
45 50
     }
46 51
 
52
+    /**
53
+     * Returns a boolean value indicating if this button is disabled or not.
54
+     *
55
+     * @protected
56
+     * @returns {boolean}
57
+     */
58
+    _isDisabled() {
59
+        return this.props._disabled;
60
+    }
61
+
47 62
     /**
48 63
      * Indicates whether this button is in toggled state or not.
49 64
      *
@@ -63,7 +78,6 @@ class ScreenSharingAndroidButton extends AbstractButton<Props, *> {
63 78
  * @param {Object} state - The Redux state.
64 79
  * @private
65 80
  * @returns {{
66
- *     _disabled: boolean,
67 81
  *     _screensharing: boolean
68 82
  * }}
69 83
  */

+ 23
- 1
react/features/toolbox/components/native/ScreenSharingButton.js 查看文件

@@ -1,6 +1,10 @@
1
+// @flow
2
+
1 3
 import React from 'react';
2 4
 import { Platform } from 'react-native';
3 5
 
6
+import { connect } from '../../../base/redux';
7
+
4 8
 import ScreenSharingAndroidButton from './ScreenSharingAndroidButton.js';
5 9
 import ScreenSharingIosButton from './ScreenSharingIosButton.js';
6 10
 
@@ -15,4 +19,22 @@ const ScreenSharingButton = props => (
15 19
     </>
16 20
 );
17 21
 
18
-export default ScreenSharingButton;
22
+/**
23
+ * Maps (parts of) the redux state to the associated props for the
24
+ * {@code ScreenSharingButton} component.
25
+ *
26
+ * @param {Object} state - The Redux state.
27
+ * @private
28
+ * @returns {{
29
+ *     _disabled: boolean,
30
+ * }}
31
+ */
32
+function _mapStateToProps(state): Object {
33
+    const disabled = state['features/base/audio-only'].enabled;
34
+
35
+    return {
36
+        _disabled: disabled
37
+    };
38
+}
39
+
40
+export default connect(_mapStateToProps)(ScreenSharingButton);

+ 15
- 0
react/features/toolbox/components/native/ScreenSharingIosButton.js 查看文件

@@ -16,6 +16,11 @@ import { isLocalVideoTrackDesktop } from '../../../base/tracks';
16 16
  */
17 17
 type Props = AbstractButtonProps & {
18 18
 
19
+    /**
20
+     * True if the button needs to be disabled.
21
+     */
22
+    _disabled: boolean,
23
+
19 24
     /**
20 25
      * Whether video is currently muted or not.
21 26
      */
@@ -84,6 +89,16 @@ class ScreenSharingIosButton extends AbstractButton<Props, *> {
84 89
       NativeModules.ScreenCapturePickerViewManager.show(handle);
85 90
   }
86 91
 
92
+  /**
93
+   * Returns a boolean value indicating if this button is disabled or not.
94
+   *
95
+   * @protected
96
+   * @returns {boolean}
97
+   */
98
+  _isDisabled() {
99
+      return this.props._disabled;
100
+  }
101
+
87 102
   /**
88 103
    * Indicates whether this button is in toggled state or not.
89 104
    *

Loading…
取消
儲存