|
|
|
@ -1,18 +1,22 @@ |
|
|
|
|
// @flow
|
|
|
|
|
|
|
|
|
|
import React, { PureComponent } from 'react'; |
|
|
|
|
import React from 'react'; |
|
|
|
|
import { SafeAreaView, View } from 'react-native'; |
|
|
|
|
|
|
|
|
|
import { ColorSchemeRegistry } from '../../../base/color-scheme'; |
|
|
|
|
import { connect } from '../../../base/redux'; |
|
|
|
|
import { StyleType } from '../../../base/styles'; |
|
|
|
|
import { ChatButton } from '../../../chat'; |
|
|
|
|
import { isToolboxVisible } from '../../functions'; |
|
|
|
|
import { InviteButton } from '../../../invite'; |
|
|
|
|
import { TileViewButton } from '../../../video-layout'; |
|
|
|
|
import { isToolboxVisible, getMovableButtons } from '../../functions.native'; |
|
|
|
|
import AudioMuteButton from '../AudioMuteButton'; |
|
|
|
|
import HangupButton from '../HangupButton'; |
|
|
|
|
import VideoMuteButton from '../VideoMuteButton'; |
|
|
|
|
|
|
|
|
|
import OverflowMenuButton from './OverflowMenuButton'; |
|
|
|
|
import RaiseHandButton from './RaiseHandButton'; |
|
|
|
|
import ToggleCameraButton from './ToggleCameraButton'; |
|
|
|
|
import styles from './styles'; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -30,6 +34,11 @@ type Props = { |
|
|
|
|
*/ |
|
|
|
|
_visible: boolean, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* The width of the screen. |
|
|
|
|
*/ |
|
|
|
|
_width: number, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* The redux {@code dispatch} function. |
|
|
|
|
*/ |
|
|
|
@ -37,80 +46,64 @@ type Props = { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Implements the conference toolbox on React Native. |
|
|
|
|
* Implements the conference Toolbox on React Native. |
|
|
|
|
* |
|
|
|
|
* @param {Object} props - The props of the component. |
|
|
|
|
* @returns {React$Element}. |
|
|
|
|
*/ |
|
|
|
|
class Toolbox extends PureComponent<Props> { |
|
|
|
|
/** |
|
|
|
|
* Implements React's {@link Component#render()}. |
|
|
|
|
* |
|
|
|
|
* @inheritdoc |
|
|
|
|
* @returns {ReactElement} |
|
|
|
|
*/ |
|
|
|
|
render() { |
|
|
|
|
if (!this.props._visible) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const { _styles } = this.props; |
|
|
|
|
const { buttonStylesBorderless, hangupButtonStyles, toggledButtonStyles } = _styles; |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<View |
|
|
|
|
pointerEvents = 'box-none' |
|
|
|
|
style = { styles.toolboxContainer }> |
|
|
|
|
<SafeAreaView |
|
|
|
|
accessibilityRole = 'toolbar' |
|
|
|
|
pointerEvents = 'box-none' |
|
|
|
|
style = { styles.toolbox }> |
|
|
|
|
<AudioMuteButton |
|
|
|
|
styles = { buttonStylesBorderless } |
|
|
|
|
toggledStyles = { toggledButtonStyles } /> |
|
|
|
|
<VideoMuteButton |
|
|
|
|
styles = { buttonStylesBorderless } |
|
|
|
|
toggledStyles = { toggledButtonStyles } /> |
|
|
|
|
<ChatButton |
|
|
|
|
styles = { buttonStylesBorderless } |
|
|
|
|
toggledStyles = { this._getChatButtonToggledStyle(toggledButtonStyles) } /> |
|
|
|
|
<OverflowMenuButton |
|
|
|
|
styles = { buttonStylesBorderless } |
|
|
|
|
toggledStyles = { toggledButtonStyles } /> |
|
|
|
|
<HangupButton |
|
|
|
|
styles = { hangupButtonStyles } /> |
|
|
|
|
</SafeAreaView> |
|
|
|
|
</View> |
|
|
|
|
); |
|
|
|
|
function Toolbox(props: Props) { |
|
|
|
|
if (!props._visible) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Constructs the toggled style of the chat button. This cannot be done by |
|
|
|
|
* simple style inheritance due to the size calculation done in this |
|
|
|
|
* component. |
|
|
|
|
* |
|
|
|
|
* @param {Object} baseStyle - The base style that was originally |
|
|
|
|
* calculated. |
|
|
|
|
* @returns {Object | Array} |
|
|
|
|
*/ |
|
|
|
|
_getChatButtonToggledStyle(baseStyle) { |
|
|
|
|
const { _styles } = this.props; |
|
|
|
|
const { _styles, _width } = props; |
|
|
|
|
const { buttonStylesBorderless, hangupButtonStyles, toggledButtonStyles } = _styles; |
|
|
|
|
const additionalButtons = getMovableButtons(_width); |
|
|
|
|
const backgroundToggledStyle = { |
|
|
|
|
...toggledButtonStyles, |
|
|
|
|
style: [ |
|
|
|
|
toggledButtonStyles.style, |
|
|
|
|
_styles.backgroundToggle |
|
|
|
|
] |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
if (Array.isArray(baseStyle.style)) { |
|
|
|
|
return { |
|
|
|
|
...baseStyle, |
|
|
|
|
style: [ |
|
|
|
|
...baseStyle.style, |
|
|
|
|
_styles.chatButtonOverride.toggled |
|
|
|
|
] |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
return ( |
|
|
|
|
<View |
|
|
|
|
pointerEvents = 'box-none' |
|
|
|
|
style = { styles.toolboxContainer }> |
|
|
|
|
<SafeAreaView |
|
|
|
|
accessibilityRole = 'toolbar' |
|
|
|
|
pointerEvents = 'box-none' |
|
|
|
|
style = { styles.toolbox }> |
|
|
|
|
<AudioMuteButton |
|
|
|
|
styles = { buttonStylesBorderless } |
|
|
|
|
toggledStyles = { toggledButtonStyles } /> |
|
|
|
|
<VideoMuteButton |
|
|
|
|
styles = { buttonStylesBorderless } |
|
|
|
|
toggledStyles = { toggledButtonStyles } /> |
|
|
|
|
{ additionalButtons.has('chat') |
|
|
|
|
&& <ChatButton |
|
|
|
|
styles = { buttonStylesBorderless } |
|
|
|
|
toggledStyles = { backgroundToggledStyle } />} |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
...baseStyle, |
|
|
|
|
style: [ |
|
|
|
|
baseStyle.style, |
|
|
|
|
_styles.chatButtonOverride.toggled |
|
|
|
|
] |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
{ additionalButtons.has('raisehand') |
|
|
|
|
&& <RaiseHandButton |
|
|
|
|
styles = { buttonStylesBorderless } |
|
|
|
|
toggledStyles = { backgroundToggledStyle } />} |
|
|
|
|
{additionalButtons.has('tileview') && <TileViewButton styles = { buttonStylesBorderless } />} |
|
|
|
|
{additionalButtons.has('invite') && <InviteButton styles = { buttonStylesBorderless } />} |
|
|
|
|
{additionalButtons.has('togglecamera') |
|
|
|
|
&& <ToggleCameraButton |
|
|
|
|
styles = { buttonStylesBorderless } |
|
|
|
|
toggledStyles = { backgroundToggledStyle } />} |
|
|
|
|
<OverflowMenuButton |
|
|
|
|
styles = { buttonStylesBorderless } |
|
|
|
|
toggledStyles = { toggledButtonStyles } /> |
|
|
|
|
<HangupButton |
|
|
|
|
styles = { hangupButtonStyles } /> |
|
|
|
|
</SafeAreaView> |
|
|
|
|
</View> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -125,7 +118,8 @@ class Toolbox extends PureComponent<Props> { |
|
|
|
|
function _mapStateToProps(state: Object): Object { |
|
|
|
|
return { |
|
|
|
|
_styles: ColorSchemeRegistry.get(state, 'Toolbox'), |
|
|
|
|
_visible: isToolboxVisible(state) |
|
|
|
|
_visible: isToolboxVisible(state), |
|
|
|
|
_width: state['features/base/responsive-ui'].clientWidth |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|