2018-02-19 22:52:21 +00:00
|
|
|
// @flow
|
|
|
|
|
2021-03-22 09:02:57 +00:00
|
|
|
import React from 'react';
|
2022-03-01 15:41:45 +00:00
|
|
|
import { View } from 'react-native';
|
|
|
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
2016-10-05 14:36:59 +00:00
|
|
|
|
2019-01-22 10:35:28 +00:00
|
|
|
import { ColorSchemeRegistry } from '../../../base/color-scheme';
|
2022-03-01 15:41:45 +00:00
|
|
|
import { Platform } from '../../../base/react';
|
2019-03-21 16:38:29 +00:00
|
|
|
import { connect } from '../../../base/redux';
|
2019-01-22 10:35:28 +00:00
|
|
|
import { StyleType } from '../../../base/styles';
|
2019-01-13 19:34:38 +00:00
|
|
|
import { ChatButton } from '../../../chat';
|
2021-07-27 14:08:33 +00:00
|
|
|
import { ParticipantsPaneButton } from '../../../participants-pane/components/native';
|
2021-07-13 06:50:08 +00:00
|
|
|
import { ReactionsMenuButton } from '../../../reactions/components';
|
2021-08-31 11:00:27 +00:00
|
|
|
import { isReactionsEnabled } from '../../../reactions/functions.any';
|
2021-03-22 09:02:57 +00:00
|
|
|
import { TileViewButton } from '../../../video-layout';
|
|
|
|
import { isToolboxVisible, getMovableButtons } from '../../functions.native';
|
2018-05-10 23:01:55 +00:00
|
|
|
import AudioMuteButton from '../AudioMuteButton';
|
|
|
|
import HangupButton from '../HangupButton';
|
2020-05-20 10:57:03 +00:00
|
|
|
import VideoMuteButton from '../VideoMuteButton';
|
2019-01-30 17:19:40 +00:00
|
|
|
|
2018-05-15 11:18:42 +00:00
|
|
|
import OverflowMenuButton from './OverflowMenuButton';
|
2021-07-22 10:17:42 +00:00
|
|
|
import RaiseHandButton from './RaiseHandButton';
|
2021-03-22 09:02:57 +00:00
|
|
|
import ToggleCameraButton from './ToggleCameraButton';
|
2019-01-22 10:35:28 +00:00
|
|
|
import styles from './styles';
|
2016-10-05 14:36:59 +00:00
|
|
|
|
2018-04-18 14:34:40 +00:00
|
|
|
/**
|
|
|
|
* The type of {@link Toolbox}'s React {@code Component} props.
|
|
|
|
*/
|
|
|
|
type Props = {
|
2018-02-06 10:41:23 +00:00
|
|
|
|
2022-03-01 15:41:45 +00:00
|
|
|
/**
|
|
|
|
* Whether or not the reactions feature is enabled.
|
|
|
|
*/
|
|
|
|
_reactionsEnabled: boolean,
|
|
|
|
|
2019-01-22 10:35:28 +00:00
|
|
|
/**
|
|
|
|
* The color-schemed stylesheet of the feature.
|
|
|
|
*/
|
|
|
|
_styles: StyleType,
|
|
|
|
|
2018-02-19 22:52:21 +00:00
|
|
|
/**
|
2018-05-15 11:18:42 +00:00
|
|
|
* The indicator which determines whether the toolbox is visible.
|
2018-02-19 22:52:21 +00:00
|
|
|
*/
|
2018-05-15 11:18:42 +00:00
|
|
|
_visible: boolean,
|
2016-10-05 14:36:59 +00:00
|
|
|
|
2021-03-22 09:02:57 +00:00
|
|
|
/**
|
|
|
|
* The width of the screen.
|
|
|
|
*/
|
2022-03-01 15:41:45 +00:00
|
|
|
_width: number
|
2018-05-15 11:18:42 +00:00
|
|
|
};
|
|
|
|
|
2018-02-19 22:52:21 +00:00
|
|
|
/**
|
2021-03-22 09:02:57 +00:00
|
|
|
* Implements the conference Toolbox on React Native.
|
|
|
|
*
|
|
|
|
* @param {Object} props - The props of the component.
|
|
|
|
* @returns {React$Element}.
|
2018-02-19 22:52:21 +00:00
|
|
|
*/
|
2021-03-22 09:02:57 +00:00
|
|
|
function Toolbox(props: Props) {
|
2022-03-01 15:41:45 +00:00
|
|
|
const { _reactionsEnabled, _styles, _visible, _width } = props;
|
|
|
|
|
|
|
|
if (!_visible) {
|
2021-03-22 09:02:57 +00:00
|
|
|
return null;
|
2017-10-19 18:29:34 +00:00
|
|
|
}
|
2018-05-16 21:49:03 +00:00
|
|
|
|
2022-03-01 15:41:45 +00:00
|
|
|
const bottomEdge = Platform.OS === 'ios' && _visible;
|
2021-03-22 09:02:57 +00:00
|
|
|
const { buttonStylesBorderless, hangupButtonStyles, toggledButtonStyles } = _styles;
|
|
|
|
const additionalButtons = getMovableButtons(_width);
|
|
|
|
const backgroundToggledStyle = {
|
|
|
|
...toggledButtonStyles,
|
|
|
|
style: [
|
|
|
|
toggledButtonStyles.style,
|
|
|
|
_styles.backgroundToggle
|
|
|
|
]
|
|
|
|
};
|
2019-01-22 10:35:28 +00:00
|
|
|
|
2021-03-22 09:02:57 +00:00
|
|
|
return (
|
|
|
|
<View
|
|
|
|
pointerEvents = 'box-none'
|
|
|
|
style = { styles.toolboxContainer }>
|
|
|
|
<SafeAreaView
|
|
|
|
accessibilityRole = 'toolbar'
|
2022-03-01 15:41:45 +00:00
|
|
|
edges = { [ bottomEdge && 'bottom' ].filter(Boolean) }
|
2021-03-22 09:02:57 +00:00
|
|
|
pointerEvents = 'box-none'
|
|
|
|
style = { styles.toolbox }>
|
|
|
|
<AudioMuteButton
|
|
|
|
styles = { buttonStylesBorderless }
|
|
|
|
toggledStyles = { toggledButtonStyles } />
|
|
|
|
<VideoMuteButton
|
|
|
|
styles = { buttonStylesBorderless }
|
|
|
|
toggledStyles = { toggledButtonStyles } />
|
2021-10-20 19:29:21 +00:00
|
|
|
{
|
|
|
|
additionalButtons.has('chat')
|
2021-03-22 09:02:57 +00:00
|
|
|
&& <ChatButton
|
|
|
|
styles = { buttonStylesBorderless }
|
2021-10-20 19:29:21 +00:00
|
|
|
toggledStyles = { backgroundToggledStyle } />
|
|
|
|
}
|
2019-01-13 19:34:38 +00:00
|
|
|
|
2021-07-22 10:17:42 +00:00
|
|
|
{ additionalButtons.has('raisehand') && (_reactionsEnabled
|
|
|
|
? <ReactionsMenuButton
|
|
|
|
styles = { buttonStylesBorderless }
|
|
|
|
toggledStyles = { backgroundToggledStyle } />
|
|
|
|
: <RaiseHandButton
|
2021-07-13 06:50:08 +00:00
|
|
|
styles = { buttonStylesBorderless }
|
2021-07-22 10:17:42 +00:00
|
|
|
toggledStyles = { backgroundToggledStyle } />)}
|
2021-03-22 09:02:57 +00:00
|
|
|
{additionalButtons.has('tileview') && <TileViewButton styles = { buttonStylesBorderless } />}
|
2021-07-27 14:08:33 +00:00
|
|
|
{additionalButtons.has('participantspane')
|
|
|
|
&& <ParticipantsPaneButton
|
|
|
|
styles = { buttonStylesBorderless } />
|
|
|
|
}
|
2021-03-22 09:02:57 +00:00
|
|
|
{additionalButtons.has('togglecamera')
|
|
|
|
&& <ToggleCameraButton
|
|
|
|
styles = { buttonStylesBorderless }
|
|
|
|
toggledStyles = { backgroundToggledStyle } />}
|
|
|
|
<OverflowMenuButton
|
|
|
|
styles = { buttonStylesBorderless }
|
|
|
|
toggledStyles = { toggledButtonStyles } />
|
|
|
|
<HangupButton
|
|
|
|
styles = { hangupButtonStyles } />
|
|
|
|
</SafeAreaView>
|
|
|
|
</View>
|
|
|
|
);
|
2016-10-05 14:36:59 +00:00
|
|
|
}
|
|
|
|
|
2017-02-16 23:02:40 +00:00
|
|
|
/**
|
2018-04-18 14:34:40 +00:00
|
|
|
* Maps parts of the redux state to {@link Toolbox} (React {@code Component})
|
2018-02-19 22:52:21 +00:00
|
|
|
* props.
|
2017-02-16 23:02:40 +00:00
|
|
|
*
|
2018-04-18 14:34:40 +00:00
|
|
|
* @param {Object} state - The redux state of which parts are to be mapped to
|
|
|
|
* {@code Toolbox} props.
|
2018-05-11 02:10:26 +00:00
|
|
|
* @private
|
2020-04-29 07:35:18 +00:00
|
|
|
* @returns {Props}
|
2017-02-16 23:02:40 +00:00
|
|
|
*/
|
2018-04-18 14:34:40 +00:00
|
|
|
function _mapStateToProps(state: Object): Object {
|
2017-02-16 23:02:40 +00:00
|
|
|
return {
|
2019-01-22 10:35:28 +00:00
|
|
|
_styles: ColorSchemeRegistry.get(state, 'Toolbox'),
|
2021-03-22 09:02:57 +00:00
|
|
|
_visible: isToolboxVisible(state),
|
2021-07-22 10:17:42 +00:00
|
|
|
_width: state['features/base/responsive-ui'].clientWidth,
|
2021-08-31 11:00:27 +00:00
|
|
|
_reactionsEnabled: isReactionsEnabled(state)
|
2017-02-16 23:02:40 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-08-29 19:04:05 +00:00
|
|
|
export default connect(_mapStateToProps)(Toolbox);
|