|
@@ -1,18 +1,22 @@
|
1
|
1
|
// @flow
|
2
|
2
|
|
3
|
|
-import React, { PureComponent } from 'react';
|
|
3
|
+import React from 'react';
|
4
|
4
|
import { SafeAreaView, View } from 'react-native';
|
5
|
5
|
|
6
|
6
|
import { ColorSchemeRegistry } from '../../../base/color-scheme';
|
7
|
7
|
import { connect } from '../../../base/redux';
|
8
|
8
|
import { StyleType } from '../../../base/styles';
|
9
|
9
|
import { ChatButton } from '../../../chat';
|
10
|
|
-import { isToolboxVisible } from '../../functions';
|
|
10
|
+import { InviteButton } from '../../../invite';
|
|
11
|
+import { TileViewButton } from '../../../video-layout';
|
|
12
|
+import { isToolboxVisible, getMovableButtons } from '../../functions.native';
|
11
|
13
|
import AudioMuteButton from '../AudioMuteButton';
|
12
|
14
|
import HangupButton from '../HangupButton';
|
13
|
15
|
import VideoMuteButton from '../VideoMuteButton';
|
14
|
16
|
|
15
|
17
|
import OverflowMenuButton from './OverflowMenuButton';
|
|
18
|
+import RaiseHandButton from './RaiseHandButton';
|
|
19
|
+import ToggleCameraButton from './ToggleCameraButton';
|
16
|
20
|
import styles from './styles';
|
17
|
21
|
|
18
|
22
|
/**
|
|
@@ -30,6 +34,11 @@ type Props = {
|
30
|
34
|
*/
|
31
|
35
|
_visible: boolean,
|
32
|
36
|
|
|
37
|
+ /**
|
|
38
|
+ * The width of the screen.
|
|
39
|
+ */
|
|
40
|
+ _width: number,
|
|
41
|
+
|
33
|
42
|
/**
|
34
|
43
|
* The redux {@code dispatch} function.
|
35
|
44
|
*/
|
|
@@ -37,80 +46,64 @@ type Props = {
|
37
|
46
|
};
|
38
|
47
|
|
39
|
48
|
/**
|
40
|
|
- * Implements the conference toolbox on React Native.
|
|
49
|
+ * Implements the conference Toolbox on React Native.
|
|
50
|
+ *
|
|
51
|
+ * @param {Object} props - The props of the component.
|
|
52
|
+ * @returns {React$Element}.
|
41
|
53
|
*/
|
42
|
|
-class Toolbox extends PureComponent<Props> {
|
43
|
|
- /**
|
44
|
|
- * Implements React's {@link Component#render()}.
|
45
|
|
- *
|
46
|
|
- * @inheritdoc
|
47
|
|
- * @returns {ReactElement}
|
48
|
|
- */
|
49
|
|
- render() {
|
50
|
|
- if (!this.props._visible) {
|
51
|
|
- return null;
|
52
|
|
- }
|
53
|
|
-
|
54
|
|
- const { _styles } = this.props;
|
55
|
|
- const { buttonStylesBorderless, hangupButtonStyles, toggledButtonStyles } = _styles;
|
56
|
|
-
|
57
|
|
- return (
|
58
|
|
- <View
|
59
|
|
- pointerEvents = 'box-none'
|
60
|
|
- style = { styles.toolboxContainer }>
|
61
|
|
- <SafeAreaView
|
62
|
|
- accessibilityRole = 'toolbar'
|
63
|
|
- pointerEvents = 'box-none'
|
64
|
|
- style = { styles.toolbox }>
|
65
|
|
- <AudioMuteButton
|
66
|
|
- styles = { buttonStylesBorderless }
|
67
|
|
- toggledStyles = { toggledButtonStyles } />
|
68
|
|
- <VideoMuteButton
|
69
|
|
- styles = { buttonStylesBorderless }
|
70
|
|
- toggledStyles = { toggledButtonStyles } />
|
71
|
|
- <ChatButton
|
72
|
|
- styles = { buttonStylesBorderless }
|
73
|
|
- toggledStyles = { this._getChatButtonToggledStyle(toggledButtonStyles) } />
|
74
|
|
- <OverflowMenuButton
|
75
|
|
- styles = { buttonStylesBorderless }
|
76
|
|
- toggledStyles = { toggledButtonStyles } />
|
77
|
|
- <HangupButton
|
78
|
|
- styles = { hangupButtonStyles } />
|
79
|
|
- </SafeAreaView>
|
80
|
|
- </View>
|
81
|
|
- );
|
|
54
|
+function Toolbox(props: Props) {
|
|
55
|
+ if (!props._visible) {
|
|
56
|
+ return null;
|
82
|
57
|
}
|
83
|
58
|
|
84
|
|
- /**
|
85
|
|
- * Constructs the toggled style of the chat button. This cannot be done by
|
86
|
|
- * simple style inheritance due to the size calculation done in this
|
87
|
|
- * component.
|
88
|
|
- *
|
89
|
|
- * @param {Object} baseStyle - The base style that was originally
|
90
|
|
- * calculated.
|
91
|
|
- * @returns {Object | Array}
|
92
|
|
- */
|
93
|
|
- _getChatButtonToggledStyle(baseStyle) {
|
94
|
|
- const { _styles } = this.props;
|
|
59
|
+ const { _styles, _width } = props;
|
|
60
|
+ const { buttonStylesBorderless, hangupButtonStyles, toggledButtonStyles } = _styles;
|
|
61
|
+ const additionalButtons = getMovableButtons(_width);
|
|
62
|
+ const backgroundToggledStyle = {
|
|
63
|
+ ...toggledButtonStyles,
|
|
64
|
+ style: [
|
|
65
|
+ toggledButtonStyles.style,
|
|
66
|
+ _styles.backgroundToggle
|
|
67
|
+ ]
|
|
68
|
+ };
|
95
|
69
|
|
96
|
|
- if (Array.isArray(baseStyle.style)) {
|
97
|
|
- return {
|
98
|
|
- ...baseStyle,
|
99
|
|
- style: [
|
100
|
|
- ...baseStyle.style,
|
101
|
|
- _styles.chatButtonOverride.toggled
|
102
|
|
- ]
|
103
|
|
- };
|
104
|
|
- }
|
|
70
|
+ return (
|
|
71
|
+ <View
|
|
72
|
+ pointerEvents = 'box-none'
|
|
73
|
+ style = { styles.toolboxContainer }>
|
|
74
|
+ <SafeAreaView
|
|
75
|
+ accessibilityRole = 'toolbar'
|
|
76
|
+ pointerEvents = 'box-none'
|
|
77
|
+ style = { styles.toolbox }>
|
|
78
|
+ <AudioMuteButton
|
|
79
|
+ styles = { buttonStylesBorderless }
|
|
80
|
+ toggledStyles = { toggledButtonStyles } />
|
|
81
|
+ <VideoMuteButton
|
|
82
|
+ styles = { buttonStylesBorderless }
|
|
83
|
+ toggledStyles = { toggledButtonStyles } />
|
|
84
|
+ { additionalButtons.has('chat')
|
|
85
|
+ && <ChatButton
|
|
86
|
+ styles = { buttonStylesBorderless }
|
|
87
|
+ toggledStyles = { backgroundToggledStyle } />}
|
105
|
88
|
|
106
|
|
- return {
|
107
|
|
- ...baseStyle,
|
108
|
|
- style: [
|
109
|
|
- baseStyle.style,
|
110
|
|
- _styles.chatButtonOverride.toggled
|
111
|
|
- ]
|
112
|
|
- };
|
113
|
|
- }
|
|
89
|
+ { additionalButtons.has('raisehand')
|
|
90
|
+ && <RaiseHandButton
|
|
91
|
+ styles = { buttonStylesBorderless }
|
|
92
|
+ toggledStyles = { backgroundToggledStyle } />}
|
|
93
|
+ {additionalButtons.has('tileview') && <TileViewButton styles = { buttonStylesBorderless } />}
|
|
94
|
+ {additionalButtons.has('invite') && <InviteButton styles = { buttonStylesBorderless } />}
|
|
95
|
+ {additionalButtons.has('togglecamera')
|
|
96
|
+ && <ToggleCameraButton
|
|
97
|
+ styles = { buttonStylesBorderless }
|
|
98
|
+ toggledStyles = { backgroundToggledStyle } />}
|
|
99
|
+ <OverflowMenuButton
|
|
100
|
+ styles = { buttonStylesBorderless }
|
|
101
|
+ toggledStyles = { toggledButtonStyles } />
|
|
102
|
+ <HangupButton
|
|
103
|
+ styles = { hangupButtonStyles } />
|
|
104
|
+ </SafeAreaView>
|
|
105
|
+ </View>
|
|
106
|
+ );
|
114
|
107
|
}
|
115
|
108
|
|
116
|
109
|
/**
|
|
@@ -125,7 +118,8 @@ class Toolbox extends PureComponent<Props> {
|
125
|
118
|
function _mapStateToProps(state: Object): Object {
|
126
|
119
|
return {
|
127
|
120
|
_styles: ColorSchemeRegistry.get(state, 'Toolbox'),
|
128
|
|
- _visible: isToolboxVisible(state)
|
|
121
|
+ _visible: isToolboxVisible(state),
|
|
122
|
+ _width: state['features/base/responsive-ui'].clientWidth
|
129
|
123
|
};
|
130
|
124
|
}
|
131
|
125
|
|