Procházet zdrojové kódy

feat(native-participants-pane) rebase, resolved conflicts pt. 2

master
Calin Chitu před 4 roky
rodič
revize
b268e01a42

+ 0
- 17
react/features/base/participants/functions.js Zobrazit soubor

@@ -261,23 +261,6 @@ export function haveParticipantWithScreenSharingFeature(stateful: Object | Funct
261 261
     return toState(stateful)['features/base/participants'].haveParticipantWithScreenSharingFeature;
262 262
 }
263 263
 
264
-/**
265
- * Selectors for getting all known participant ids, with fake participants filtered
266
- * out.
267
- *
268
- * @param {(Function|Object|Participant[])} stateful - The redux state
269
- * features/base/participants, the (whole) redux state, or redux's
270
- * {@code getState} function to be used to retrieve the state
271
- * features/base/participants.
272
- * @returns {Participant[]}
273
- */
274
-export function getParticipantsById(stateful: Object | Function) {
275
-    const state = toState(stateful)['features/base/participants'];
276
-    const noFakeParticipants = state.filter(p => !p.fakeParticipants);
277
-
278
-    return noFakeParticipants.map(p => p.id);
279
-}
280
-
281 264
 /**
282 265
  * Selectors for getting all remote participants.
283 266
  *

+ 1
- 1
react/features/lobby/functions.js Zobrazit soubor

@@ -12,7 +12,7 @@ export function getLobbyState(state: any) {
12 12
 
13 13
 
14 14
 /**
15
- * Selector to return lobby state.
15
+ * Selector to return array with knocking participant ids.
16 16
  *
17 17
  * @param {any} state - State object.
18 18
  * @returns {Array}

+ 4
- 1
react/features/participants-pane/actions.native.js Zobrazit soubor

@@ -3,7 +3,10 @@
3 3
 import { openDialog } from '../base/dialog';
4 4
 
5 5
 import { SET_VOLUME } from './actionTypes';
6
-import { ContextMenuLobbyParticipantReject, ContextMenuMeetingParticipantDetails } from './components/native';
6
+import {
7
+    ContextMenuMeetingParticipantDetails,
8
+    ContextMenuLobbyParticipantReject
9
+} from './components/native';
7 10
 export * from './actions.any';
8 11
 
9 12
 /**

+ 3
- 1
react/features/participants-pane/components/native/ContextMenuLobbyParticipantReject.js Zobrazit soubor

@@ -24,7 +24,7 @@ type Props = {
24 24
     participant: Object
25 25
 };
26 26
 
27
-export const ContextMenuLobbyParticipantReject = ({ participant: p }: Props) => {
27
+const ContextMenuLobbyParticipantReject = ({ participant: p }: Props) => {
28 28
     const dispatch = useDispatch();
29 29
     const knockParticipantsIDArr = useSelector(getKnockingParticipantsById);
30 30
     const knockParticipantIsAvailable = knockParticipantsIDArr.find(knockPartId => knockPartId === p.id);
@@ -63,3 +63,5 @@ export const ContextMenuLobbyParticipantReject = ({ participant: p }: Props) =>
63 63
         </BottomSheet>
64 64
     );
65 65
 };
66
+
67
+export default ContextMenuLobbyParticipantReject;

+ 37
- 28
react/features/participants-pane/components/native/ContextMenuMeetingParticipantDetails.js Zobrazit soubor

@@ -7,7 +7,6 @@ import { Divider, Text } from 'react-native-paper';
7 7
 import { useDispatch } 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/actions';
12 11
 import BottomSheet from '../../../base/dialog/components/native/BottomSheet';
13 12
 import {
@@ -16,7 +15,9 @@ import {
16 15
     IconMuteEveryoneElse, IconVideoOff
17 16
 } from '../../../base/icons';
18 17
 import {
19
-    getParticipantByIdOrUndefined, getParticipantDisplayName,
18
+    getLocalParticipant,
19
+    getParticipantByIdOrUndefined,
20
+    getParticipantDisplayName, getRemoteParticipants,
20 21
     isLocalParticipantModerator
21 22
 } from '../../../base/participants/functions';
22 23
 import { connect } from '../../../base/redux';
@@ -29,9 +30,9 @@ import {
29 30
     KickRemoteParticipantDialog,
30 31
     MuteEveryoneDialog,
31 32
     MuteRemoteParticipantDialog,
32
-    MuteRemoteParticipantsVideoDialog,
33
-    VolumeSlider
33
+    MuteRemoteParticipantsVideoDialog
34 34
 } from '../../../video-menu';
35
+import VolumeSlider from '../../../video-menu/components/native/VolumeSlider';
35 36
 
36 37
 import styles from './styles';
37 38
 
@@ -47,11 +48,6 @@ type Props = {
47 48
      */
48 49
     _isLocalModerator: boolean,
49 50
 
50
-    /**
51
-     * True if the chat button is enabled and false otherwise.
52
-     */
53
-    _isChatButtonEnabled: boolean,
54
-
55 51
     /**
56 52
      * True if the participant is moderator and false otherwise.
57 53
      */
@@ -67,6 +63,11 @@ type Props = {
67 63
      */
68 64
     _isParticipantAudioMuted: boolean,
69 65
 
66
+    /**
67
+     * Whether the participant is present in the room or not.
68
+     */
69
+    _isParticipantIDAvailable?: boolean,
70
+
70 71
     /**
71 72
      * Participant reference
72 73
      */
@@ -78,14 +79,14 @@ type Props = {
78 79
     participantID: string,
79 80
 };
80 81
 
81
-export const ContextMenuMeetingParticipantDetails = (
82
+const ContextMenuMeetingParticipantDetails = (
82 83
         {
83 84
             _displayName,
84 85
             _isLocalModerator,
85
-            _isChatButtonEnabled,
86 86
             _isParticipantVideoMuted,
87 87
             _isParticipantAudioMuted,
88 88
             _participant,
89
+            _isParticipantIDAvailable,
89 90
             participantID
90 91
         }: Props) => {
91 92
     const dispatch = useDispatch();
@@ -121,6 +122,7 @@ export const ContextMenuMeetingParticipantDetails = (
121 122
         <BottomSheet
122 123
             addScrollViewPadding = { false }
123 124
             onCancel = { cancel }
125
+            showSlidingView = { _isParticipantIDAvailable }
124 126
             style = { styles.contextMenuMeetingParticipantDetails }>
125 127
             <View
126 128
                 style = { styles.contextMenuItemSectionAvatar }>
@@ -196,20 +198,16 @@ export const ContextMenuMeetingParticipantDetails = (
196 198
                     </>
197 199
                 )
198 200
             }
199
-            {
200
-                _isChatButtonEnabled && (
201
-                    <TouchableOpacity
202
-                        onPress = { sendPrivateMessage }
203
-                        style = { styles.contextMenuItem }>
204
-                        <Icon
205
-                            size = { 20 }
206
-                            src = { IconMessage } />
207
-                        <Text style = { styles.contextMenuItemText }>
208
-                            { t('toolbar.accessibilityLabel.privateMessage') }
209
-                        </Text>
210
-                    </TouchableOpacity>
211
-                )
212
-            }
201
+            <TouchableOpacity
202
+                onPress = { sendPrivateMessage }
203
+                style = { styles.contextMenuItem }>
204
+                <Icon
205
+                    size = { 20 }
206
+                    src = { IconMessage } />
207
+                <Text style = { styles.contextMenuItemText }>
208
+                    { t('toolbar.accessibilityLabel.privateMessage') }
209
+                </Text>
210
+            </TouchableOpacity>
213 211
             {/* We need design specs for this*/}
214 212
             {/* <TouchableOpacity*/}
215 213
             {/*    style = { styles.contextMenuItemSection }>*/}
@@ -220,7 +218,7 @@ export const ContextMenuMeetingParticipantDetails = (
220 218
             {/*    <Text style = { styles.contextMenuItemText }>{ t('participantsPane.actions.networkStats') }</Text>*/}
221 219
             {/* </TouchableOpacity>*/}
222 220
             <Divider style = { styles.divider } />
223
-            <VolumeSlider participant = { _participant } />
221
+            <VolumeSlider participantID = { participantID } />
224 222
         </BottomSheet>
225 223
     );
226 224
 };
@@ -236,17 +234,28 @@ export const ContextMenuMeetingParticipantDetails = (
236 234
  */
237 235
 function _mapStateToProps(state, ownProps): Object {
238 236
     const { participantID } = ownProps;
237
+    const participantIDS = [];
238
+
239 239
     const participant = getParticipantByIdOrUndefined(state, participantID);
240 240
     const _isLocalModerator = isLocalParticipantModerator(state);
241
-    const _isChatButtonEnabled = isToolbarButtonEnabled('chat', state);
242 241
     const _isParticipantVideoMuted = isParticipantVideoMuted(participant, state);
243 242
     const _isParticipantAudioMuted = isParticipantAudioMuted(participant, state);
243
+    const localParticipant = getLocalParticipant(state);
244
+    const remoteParticipants = getRemoteParticipants(state);
245
+
246
+    localParticipant && participantIDS.push(localParticipant?.id);
247
+
248
+    remoteParticipants.forEach(p => {
249
+        participantIDS.push(p?.id);
250
+    });
251
+
252
+    const isParticipantIDAvailable = participantIDS.find(partID => partID === participantID);
244 253
 
245 254
     return {
246 255
         _displayName: getParticipantDisplayName(state, participantID),
247 256
         _isLocalModerator,
248
-        _isChatButtonEnabled,
249 257
         _isParticipantAudioMuted,
258
+        _isParticipantIDAvailable: Boolean(isParticipantIDAvailable),
250 259
         _isParticipantVideoMuted,
251 260
         _participant: participant
252 261
     };

+ 17
- 14
react/features/participants-pane/components/native/MeetingParticipantItem.js Zobrazit soubor

@@ -62,30 +62,33 @@ type Props = {
62 62
     participantID: ?string
63 63
 };
64 64
 
65
-const MeetingParticipantItem = (
66
-        {
67
-            _audioMediaState,
68
-            _displayName,
69
-            _isVideoMuted,
70
-            _local,
71
-            _participantID,
72
-            _raisedHand,
73
-            onPress
74
-        }: Props) => {
75
-    const showParticipantDetails = !_local && onPress;
76
-
65
+/**
66
+ * Implements the MeetingParticipantItem component.
67
+ *
68
+ * @param {Props} props - The props of the component.
69
+ * @returns {ReactElement}
70
+ */
71
+function MeetingParticipantItem({
72
+    _audioMediaState,
73
+    _displayName,
74
+    _isVideoMuted,
75
+    _local,
76
+    _participantID,
77
+    _raisedHand,
78
+    onPress
79
+}: Props) {
77 80
     return (
78 81
         <ParticipantItem
79 82
             audioMediaState = { _audioMediaState }
80 83
             displayName = { _displayName }
81 84
             isKnockingParticipant = { false }
82 85
             local = { _local }
83
-            onPress = { showParticipantDetails }
86
+            onPress = { onPress }
84 87
             participantID = { _participantID }
85 88
             raisedHand = { _raisedHand }
86 89
             videoMediaState = { _isVideoMuted ? MEDIA_STATE.MUTED : MEDIA_STATE.UNMUTED } />
87 90
     );
88
-};
91
+}
89 92
 
90 93
 /**
91 94
  * Maps (parts of) the redux state to the associated props for this component.

+ 1
- 1
react/features/participants-pane/components/native/MeetingParticipantList.js Zobrazit soubor

@@ -35,7 +35,7 @@ export const MeetingParticipantList = () => {
35 35
         <MeetingParticipantItem
36 36
             key = { id }
37 37
             /* eslint-disable-next-line react/jsx-no-bind */
38
-            onPress = { () => dispatch(showContextMenuDetails(id)) }
38
+            onPress = { () => !localParticipant && dispatch(showContextMenuDetails(id)) }
39 39
             participantID = { id } />
40 40
     );
41 41
 

+ 2
- 2
react/features/participants-pane/components/native/index.js Zobrazit soubor

@@ -2,5 +2,5 @@
2 2
 
3 3
 export { default as ParticipantsPane } from './ParticipantsPane';
4 4
 export { default as ParticipantsPaneButton } from './ParticipantsPaneButton';
5
-export { ContextMenuLobbyParticipantReject } from './ContextMenuLobbyParticipantReject';
6
-export { ContextMenuMeetingParticipantDetails } from './ContextMenuMeetingParticipantDetails';
5
+export { default as ContextMenuLobbyParticipantReject } from './ContextMenuLobbyParticipantReject';
6
+export { default as ContextMenuMeetingParticipantDetails } from './ContextMenuMeetingParticipantDetails';

+ 5
- 13
react/features/video-menu/components/native/VolumeSlider.js Zobrazit soubor

@@ -6,7 +6,7 @@ import { Slider, View } from 'react-native';
6 6
 import { withTheme } from 'react-native-paper';
7 7
 
8 8
 import { Icon, IconVolumeEmpty } from '../../../base/icons';
9
-import { getParticipantByIdOrUndefined } from '../../../base/participants';
9
+import { getLocalParticipant } from '../../../base/participants';
10 10
 import { connect } from '../../../base/redux';
11 11
 import { setVolume } from '../../../participants-pane/actions.native';
12 12
 import { VOLUME_SLIDER_SCALE } from '../../constants';
@@ -19,11 +19,6 @@ import styles from './styles';
19 19
  */
20 20
 type Props = {
21 21
 
22
-    /**
23
-     * Participant reference
24
-     */
25
-    _participant: Object,
26
-
27 22
     /**
28 23
      * Whether the participant enters the conference silent.
29 24
      */
@@ -131,10 +126,9 @@ class VolumeSlider extends PureComponent<Props, State> {
131 126
      * @returns {void}
132 127
      */
133 128
     _onVolumeChange(volumeLevel) {
134
-        const { dispatch, _participant } = this.props;
135
-        const { id } = _participant;
129
+        const { dispatch, participantID } = this.props;
136 130
 
137
-        dispatch(setVolume(id, volumeLevel));
131
+        dispatch(setVolume(participantID, volumeLevel));
138 132
     }
139 133
 }
140 134
 
@@ -148,15 +142,13 @@ class VolumeSlider extends PureComponent<Props, State> {
148 142
  */
149 143
 function mapStateToProps(state, ownProps): Object {
150 144
     const { participantID } = ownProps;
151
-    const participant = getParticipantByIdOrUndefined(state, participantID);
152
-    const { id, local } = participant;
153 145
     const { participantsVolume } = state['features/participants-pane'];
154 146
     const { startSilent } = state['features/base/config'];
147
+    const localParticipant = getLocalParticipant(state);
155 148
 
156 149
     return {
157
-        _participant: participant,
158 150
         _startSilent: Boolean(startSilent),
159
-        _volume: local ? undefined : participantsVolume[id]
151
+        _volume: localParticipant ? undefined : participantsVolume[participantID]
160 152
     };
161 153
 }
162 154
 

Načítá se…
Zrušit
Uložit