Ver código fonte

feat(native-participants-pane) fixed slider and hid dialog when chat is open

master
Calin Chitu 4 anos atrás
pai
commit
ba9398a1e2

+ 22
- 19
react/features/participants-pane/components/native/ContextMenuMeetingParticipantDetails.js Ver arquivo

@@ -1,13 +1,12 @@
1 1
 // @flow
2 2
 
3
-import React, { useCallback } from 'react';
3
+import React, { useCallback, useState } from 'react';
4 4
 import { useTranslation } from 'react-i18next';
5 5
 import { TouchableOpacity, View } from 'react-native';
6 6
 import { Text } from 'react-native-paper';
7
-import { useDispatch, useSelector } from 'react-redux';
7
+import { useDispatch, useSelector, useStore } from 'react-redux';
8 8
 
9 9
 import { Avatar } from '../../../base/avatar';
10
-import { isToolbarButtonEnabled } from '../../../base/config';
11 10
 import { hideDialog, openDialog } from '../../../base/dialog';
12 11
 import BottomSheet from '../../../base/dialog/components/native/BottomSheet';
13 12
 import {
@@ -37,11 +36,14 @@ type Props = {
37 36
 };
38 37
 
39 38
 export const ContextMenuMeetingParticipantDetails = ({ participant: p }: Props) => {
39
+    const [ volume, setVolume ] = useState(undefined);
40
+    const store = useStore();
41
+    const startSilent = store.getState['features/base/config'];
40 42
     const dispatch = useDispatch();
41 43
     const cancel = useCallback(() => dispatch(hideDialog()), [ dispatch ]);
44
+    const changeVolume = useCallback(() => setVolume(volume), [ volume ]);
42 45
     const displayName = p.name;
43 46
     const isLocalModerator = useSelector(isLocalParticipantModerator);
44
-    const isChatButtonEnabled = useSelector(isToolbarButtonEnabled('chat'));
45 47
     const isParticipantVideoMuted = useSelector(getIsParticipantVideoMuted(p));
46 48
     const kickRemoteParticipant = useCallback(() => {
47 49
         dispatch(openDialog(KickRemoteParticipantDialog, {
@@ -63,7 +65,9 @@ export const ContextMenuMeetingParticipantDetails = ({ participant: p }: Props)
63 65
             participantID: p.id
64 66
         }));
65 67
     }, [ dispatch, p ]);
68
+    const onVolumeChange = startSilent ? undefined : changeVolume;
66 69
     const sendPrivateMessage = useCallback(() => {
70
+        dispatch(hideDialog());
67 71
         dispatch(openChat(p));
68 72
     }, [ dispatch, p ]);
69 73
     const { t } = useTranslation();
@@ -142,20 +146,17 @@ export const ContextMenuMeetingParticipantDetails = ({ participant: p }: Props)
142 146
                     </Text>
143 147
                 </TouchableOpacity>
144 148
             }
145
-            {
146
-                isChatButtonEnabled
147
-                && <TouchableOpacity
148
-                    onPress = { sendPrivateMessage }
149
-                    style = { styles.contextMenuItem }>
150
-                    <Icon
151
-                        size = { 24 }
152
-                        src = { IconMessage }
153
-                        style = { styles.contextMenuItemIcon } />
154
-                    <Text style = { styles.contextMenuItemText }>
155
-                        { t('toolbar.accessibilityLabel.privateMessage') }
156
-                    </Text>
157
-                </TouchableOpacity>
158
-            }
149
+            <TouchableOpacity
150
+                onPress = { sendPrivateMessage }
151
+                style = { styles.contextMenuItem }>
152
+                <Icon
153
+                    size = { 24 }
154
+                    src = { IconMessage }
155
+                    style = { styles.contextMenuItemIcon } />
156
+                <Text style = { styles.contextMenuItemText }>
157
+                    { t('toolbar.accessibilityLabel.privateMessage') }
158
+                </Text>
159
+            </TouchableOpacity>
159 160
             <TouchableOpacity
160 161
                 style = { styles.contextMenuItemSection }>
161 162
                 <Icon
@@ -164,7 +165,9 @@ export const ContextMenuMeetingParticipantDetails = ({ participant: p }: Props)
164 165
                     style = { styles.contextMenuItemIcon } />
165 166
                 <Text style = { styles.contextMenuItemText }>{ t('participantsPane.actions.networkStats') }</Text>
166 167
             </TouchableOpacity>
167
-            <VolumeSlider />
168
+            <VolumeSlider
169
+                initialValue = { volume }
170
+                onChange = { onVolumeChange } />
168 171
         </BottomSheet>
169 172
     );
170 173
 };

+ 6
- 1
react/features/participants-pane/components/native/ContextMenuMore.js Ver arquivo

@@ -13,7 +13,10 @@ import {
13 13
     IconVideoOff
14 14
 } from '../../../base/icons';
15 15
 import { MEDIA_TYPE } from '../../../base/media';
16
-import { muteAllParticipants } from '../../../video-menu/actions.any';
16
+import {
17
+    muteAllParticipants,
18
+    unmuteDisabled
19
+} from '../../../video-menu/actions.any';
17 20
 
18 21
 import styles from './styles';
19 22
 type Props = {
@@ -32,6 +35,7 @@ type Props = {
32 35
 export const ContextMenuMore = ({ exclude }: Props) => {
33 36
     const dispatch = useDispatch();
34 37
     const cancel = useCallback(() => dispatch(hideDialog()), [ dispatch ]);
38
+    const unMuteDisabled = useCallback(() => dispatch(unmuteDisabled()), [ dispatch ]);
35 39
     const muteEveryoneVideo = useCallback(() => dispatch(muteAllParticipants(exclude, MEDIA_TYPE.VIDEO)), [ dispatch ]);
36 40
     const { t } = useTranslation();
37 41
 
@@ -48,6 +52,7 @@ export const ContextMenuMore = ({ exclude }: Props) => {
48 52
                 <Text style = { styles.contextMenuItemText }>{t('participantsPane.actions.stopEveryonesVideo')}</Text>
49 53
             </TouchableOpacity>
50 54
             <TouchableOpacity
55
+                onPress = { unMuteDisabled }
51 56
                 style = { styles.contextMenuItem }>
52 57
                 <Icon
53 58
                     size = { 24 }

+ 1
- 3
react/features/participants-pane/components/native/ParticipantsPane.js Ver arquivo

@@ -25,9 +25,7 @@ import styles from './styles';
25 25
 export function ParticipantsPane() {
26 26
     const dispatch = useDispatch();
27 27
     const openMoreMenu = useCallback(() => dispatch(openDialog(ContextMenuMore)));
28
-    const closePane = useCallback(
29
-        () => dispatch(hideDialog()),
30
-        [ dispatch ]);
28
+    const closePane = useCallback(() => dispatch(hideDialog()), [ dispatch ]);
31 29
     const muteAll = useCallback(() => dispatch(openDialog(MuteEveryoneDialog)),
32 30
         [ dispatch ]);
33 31
     const { t } = useTranslation();

+ 13
- 12
react/features/video-menu/components/native/VolumeSlider.js Ver arquivo

@@ -30,7 +30,7 @@ type Props = {
30 30
     /**
31 31
      * Theme used for styles.
32 32
      */
33
-    theme: Object
33
+    theme?: Object
34 34
 };
35 35
 
36 36
 /**
@@ -84,17 +84,15 @@ class VolumeSlider extends Component<Props, State> {
84 84
                 <Icon
85 85
                     size = { 24 }
86 86
                     src = { IconVolumeEmpty }
87
-                    style = { styles.volumeSliderIcon } />
88
-                <View style = { styles.sliderContainer }>
89
-                    <Slider
90
-                        maximumTrackTintColor = { palette.field02 }
91
-                        maximumValue = { VOLUME_SLIDER_SCALE }
92
-                        minimumTrackTintColor = { palette.action01 }
93
-                        minimumValue = { 0 }
94
-                        onValueChange = { this._onVolumeChange }
95
-                        /* eslint-disable-next-line react-native/no-inline-styles */
96
-                        value = { volumeLevel } />
97
-                </View>
87
+                    style = { styles.volumeIcon } />
88
+                <Slider
89
+                    maximumTrackTintColor = { palette.field02 }
90
+                    maximumValue = { VOLUME_SLIDER_SCALE }
91
+                    minimumTrackTintColor = { palette.action01 }
92
+                    minimumValue = { 0 }
93
+                    onValueChange = { this._onVolumeChange }
94
+                    style = { styles.sliderContainer }
95
+                    value = { volumeLevel } />
98 96
             </View>
99 97
 
100 98
         );
@@ -111,6 +109,9 @@ class VolumeSlider extends Component<Props, State> {
111 109
      * @returns {void}
112 110
      */
113 111
     _onVolumeChange(volumeLevel) {
112
+        const { onChange } = this.props;
113
+
114
+        onChange(volumeLevel / VOLUME_SLIDER_SCALE);
114 115
         this.setState({ volumeLevel });
115 116
     }
116 117
 }

+ 3
- 4
react/features/video-menu/components/native/styles.js Ver arquivo

@@ -55,16 +55,15 @@ export default createStyleSheet({
55 55
         alignItems: 'center',
56 56
         flexDirection: 'row',
57 57
         marginBottom: BaseTheme.spacing[3],
58
-        marginTop: BaseTheme.spacing[3],
59
-        width: '100%'
58
+        marginTop: BaseTheme.spacing[3]
60 59
     },
61 60
 
62
-    volumeSliderIcon: {
61
+    volumeIcon: {
63 62
         marginLeft: BaseTheme.spacing[1]
64 63
     },
65 64
 
66 65
     sliderContainer: {
67 66
         marginLeft: BaseTheme.spacing[3],
68
-        width: 342
67
+        minWidth: '88%'
69 68
     }
70 69
 });

Carregando…
Cancelar
Salvar