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
 // @flow
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
  * Selector to return lobby state.
4
  * Selector to return lobby state.
28
  *
5
  *

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

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

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

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

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

23
     getRemoteParticipants,
23
     getRemoteParticipants,
24
     muteRemoteParticipant
24
     muteRemoteParticipant
25
 } from '../base/participants';
25
 } from '../base/participants';
26
+import { setKnockingParticipantApproval } from '../lobby/actions';
27
+import { getLobbyState } from '../lobby/functions';
26
 
28
 
27
 declare var APP: Object;
29
 declare var APP: Object;
28
 
30
 
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