Browse Source

feat(native-participants-pane) created admitAll action

master
Calin Chitu 4 years ago
parent
commit
4b72fefd7e

+ 0
- 23
react/features/lobby/functions.js View File

@@ -1,28 +1,5 @@
1 1
 // @flow
2 2
 
3
-import { getCurrentConference } from '../base/conference';
4
-
5
-/**
6
- * Approves (lets in) or rejects a knocking participant.
7
- *
8
- * @param {Function} getState - Function to get the Redux state.
9
- * @param {string} id - The id of the knocking participant.
10
- * @param {boolean} approved - True if the participant is approved, false otherwise.
11
- * @returns {Function}
12
- */
13
-export function setKnockingParticipantApproval(getState: Function, id: string, approved: boolean) {
14
-    const conference = getCurrentConference(getState());
15
-
16
-    if (conference) {
17
-        if (approved) {
18
-            conference.lobbyApproveAccess(id);
19
-        } else {
20
-            conference.lobbyDenyAccess(id);
21
-        }
22
-    }
23
-}
24
-
25
-
26 3
 /**
27 4
  * Selector to return lobby state.
28 5
  *

+ 1
- 4
react/features/participants-pane/components/native/ContextMenuMore.js View File

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

+ 8
- 2
react/features/participants-pane/components/native/LobbyParticipantList.js View File

@@ -1,15 +1,20 @@
1 1
 // @flow
2 2
 
3
-import React from 'react';
3
+import React, { useCallback } from 'react';
4 4
 import { useTranslation } from 'react-i18next';
5 5
 import { Text, View } from 'react-native';
6 6
 import { Button } from 'react-native-paper';
7
+import { useDispatch } from 'react-redux';
8
+
9
+import { admitAllKnockingParticipants } from '../../../video-menu/actions.any';
7 10
 
8 11
 import { LobbyParticipantItem } from './LobbyParticipantItem';
9 12
 import { participants } from './participants';
10 13
 import styles from './styles';
11 14
 
12 15
 export const LobbyParticipantList = () => {
16
+    const dispatch = useDispatch();
17
+    const admitAll = useCallback(() => dispatch(admitAllKnockingParticipants()), [ dispatch ]);
13 18
     const { t } = useTranslation();
14 19
 
15 20
     return (
@@ -21,7 +26,8 @@ export const LobbyParticipantList = () => {
21 26
                 </Text>
22 27
                 <Button
23 28
                     labelStyle = { styles.allParticipantActionsButton }
24
-                    mode = 'text'>
29
+                    mode = 'text'
30
+                    onPress = { admitAll }>
25 31
                     {t('lobby.admitAll')}
26 32
                 </Button>
27 33
             </View>

+ 19
- 0
react/features/video-menu/actions.any.js View File

@@ -23,6 +23,8 @@ import {
23 23
     getRemoteParticipants,
24 24
     muteRemoteParticipant
25 25
 } from '../base/participants';
26
+import { setKnockingParticipantApproval } from '../lobby/actions';
27
+import { getLobbyState } from '../lobby/functions';
26 28
 
27 29
 declare var APP: Object;
28 30
 
@@ -106,3 +108,20 @@ export function muteAllParticipants(exclude: Array<string>, mediaType: MEDIA_TYP
106 108
         });
107 109
     };
108 110
 }
111
+
112
+/**
113
+ * Admit all knocking participants.
114
+ *
115
+ * @returns {Function}
116
+ */
117
+export function admitAllKnockingParticipants() {
118
+    return (dispatch: Dispatch<any>, getState: Function) => {
119
+        const state = getState();
120
+        const { knockingParticipants, lobbyEnabled } = getLobbyState(state);
121
+        const knockingParticipantsIds = knockingParticipants.map(participant => participant.id);
122
+
123
+        knockingParticipantsIds
124
+            .map(id => lobbyEnabled && setKnockingParticipantApproval(id, true))
125
+            .map(dispatch);
126
+    };
127
+}

Loading…
Cancel
Save