Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

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

tmoldovan8x806110d1dfb72
diff --git a/react/features/toolbox/components/native/ScreenSharingAndroidButton.js b/react/features/toolbox/components/native/ScreenSharingAndroidButton.js
index 11ccfe04fc..263679f1f5 100644
--- a/react/features/toolbox/components/native/ScreenSharingAndroidButton.js
+++ b/react/features/toolbox/components/native/ScreenSharingAndroidButton.js
@@ -11,6 +11,11 @@ import { toggleScreensharing, isLocalVideoTrackDesktop } from '../../../base/tra
*/
type Props = AbstractButtonProps & {
+ /**
+ * True if the button needs to be disabled.
+ */
+ _disabled: boolean,
+
/**
* Whether video is currently muted or not.
*/
@@ -44,6 +49,16 @@ class ScreenSharingAndroidButton extends AbstractButton<Props, *> {
this.props.dispatch(toggleScreensharing(enable));
}
+ /**
+ * Returns a boolean value indicating if this button is disabled or not.
+ *
+ * @protected
+ * @returns {boolean}
+ */
+ _isDisabled() {
+ return this.props._disabled;
+ }
+
/**
* Indicates whether this button is in toggled state or not.
*
@@ -63,7 +78,6 @@ class ScreenSharingAndroidButton extends AbstractButton<Props, *> {
* @param {Object} state - The Redux state.
* @private
* @returns {{
- * _disabled: boolean,
* _screensharing: boolean
* }}
*/
diff --git a/react/features/toolbox/components/native/ScreenSharingButton.js b/react/features/toolbox/components/native/ScreenSharingButton.js
index e75390068a..ba11cc9782 100644
--- a/react/features/toolbox/components/native/ScreenSharingButton.js
+++ b/react/features/toolbox/components/native/ScreenSharingButton.js
@@ -1,6 +1,10 @@
+// @flow
+
import React from 'react';
import { Platform } from 'react-native';
+import { connect } from '../../../base/redux';
+
import ScreenSharingAndroidButton from './ScreenSharingAndroidButton.js';
import ScreenSharingIosButton from './ScreenSharingIosButton.js';
@@ -15,4 +19,22 @@ const ScreenSharingButton = props => (
</>
);
-export default ScreenSharingButton;
+/**
+ * Maps (parts of) the redux state to the associated props for the
+ * {@code ScreenSharingButton} component.
+ *
+ * @param {Object} state - The Redux state.
+ * @private
+ * @returns {{
+ * _disabled: boolean,
+ * }}
+ */
+function _mapStateToProps(state): Object {
+ const disabled = state['features/base/audio-only'].enabled;
+
+ return {
+ _disabled: disabled
+ };
+}
+
+export default connect(_mapStateToProps)(ScreenSharingButton);
diff --git a/react/features/toolbox/components/native/ScreenSharingIosButton.js b/react/features/toolbox/components/native/ScreenSharingIosButton.js
index 0eb9734d97..2bcb90ac0c 100644
--- a/react/features/toolbox/components/native/ScreenSharingIosButton.js
+++ b/react/features/toolbox/components/native/ScreenSharingIosButton.js
@@ -16,6 +16,11 @@ import { isLocalVideoTrackDesktop } from '../../../base/tracks';
*/
type Props = AbstractButtonProps & {
+ /**
+ * True if the button needs to be disabled.
+ */
+ _disabled: boolean,
+
/**
* Whether video is currently muted or not.
*/
@@ -84,6 +89,16 @@ class ScreenSharingIosButton extends AbstractButton<Props, *> {
NativeModules.ScreenCapturePickerViewManager.show(handle);
}
+ /**
+ * Returns a boolean value indicating if this button is disabled or not.
+ *
+ * @protected
+ * @returns {boolean}
+ */
+ _isDisabled() {
+ return this.props._disabled;
+ }
+
/**
* Indicates whether this button is in toggled state or not.
*