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

This commit is contained in:
tmoldovan8x8 2021-05-26 11:43:24 +03:00 committed by GitHub
parent 8d25950d98
commit 06110d1dfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 2 deletions

View File

@ -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
* }}
*/

View File

@ -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);

View File

@ -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.
*