Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(native-participants-pane) created admitAll action

Calin Chitu4b72fefd7e8a
diff --git a/react/features/lobby/functions.js b/react/features/lobby/functions.js
index 0a4a01ce19..23d6d9c3c0 100644
--- a/react/features/lobby/functions.js
+++ b/react/features/lobby/functions.js
@@ -1,28 +1,5 @@
// @flow
-import { getCurrentConference } from '../base/conference';
-
-/**
- * Approves (lets in) or rejects a knocking participant.
- *
- * @param {Function} getState - Function to get the Redux state.
- * @param {string} id - The id of the knocking participant.
- * @param {boolean} approved - True if the participant is approved, false otherwise.
- * @returns {Function}
- */
-export function setKnockingParticipantApproval(getState: Function, id: string, approved: boolean) {
- const conference = getCurrentConference(getState());
-
- if (conference) {
- if (approved) {
- conference.lobbyApproveAccess(id);
- } else {
- conference.lobbyDenyAccess(id);
- }
- }
-}
-
-
/**
* Selector to return lobby state.
*
diff --git a/react/features/participants-pane/components/native/ContextMenuMore.js b/react/features/participants-pane/components/native/ContextMenuMore.js
index 03a9bbc615..73e522997d 100644
--- a/react/features/participants-pane/components/native/ContextMenuMore.js
+++ b/react/features/participants-pane/components/native/ContextMenuMore.js
@@ -14,8 +14,7 @@ import {
} from '../../../base/icons';
import { MEDIA_TYPE } from '../../../base/media';
import {
- muteAllParticipants,
- unmuteDisabled
+ muteAllParticipants
} from '../../../video-menu/actions.any';
import styles from './styles';
@@ -35,7 +34,6 @@ type Props = {
export const ContextMenuMore = ({ exclude }: Props) => {
const dispatch = useDispatch();
const cancel = useCallback(() => dispatch(hideDialog()), [ dispatch ]);
- const unMuteDisabled = useCallback(() => dispatch(unmuteDisabled()), [ dispatch ]);
const muteEveryoneVideo = useCallback(() => dispatch(muteAllParticipants(exclude, MEDIA_TYPE.VIDEO)), [ dispatch ]);
const { t } = useTranslation();
@@ -52,7 +50,6 @@ export const ContextMenuMore = ({ exclude }: Props) => {
<Text style = { styles.contextMenuItemText }>{t('participantsPane.actions.stopEveryonesVideo')}</Text>
</TouchableOpacity>
<TouchableOpacity
- onPress = { unMuteDisabled }
style = { styles.contextMenuItem }>
<Icon
size = { 24 }
diff --git a/react/features/participants-pane/components/native/LobbyParticipantList.js b/react/features/participants-pane/components/native/LobbyParticipantList.js
index 02e897b021..d2c86f1b53 100644
--- a/react/features/participants-pane/components/native/LobbyParticipantList.js
+++ b/react/features/participants-pane/components/native/LobbyParticipantList.js
@@ -1,15 +1,20 @@
// @flow
-import React from 'react';
+import React, { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { Text, View } from 'react-native';
import { Button } from 'react-native-paper';
+import { useDispatch } from 'react-redux';
+
+import { admitAllKnockingParticipants } from '../../../video-menu/actions.any';
import { LobbyParticipantItem } from './LobbyParticipantItem';
import { participants } from './participants';
import styles from './styles';
export const LobbyParticipantList = () => {
+ const dispatch = useDispatch();
+ const admitAll = useCallback(() => dispatch(admitAllKnockingParticipants()), [ dispatch ]);
const { t } = useTranslation();
return (
@@ -21,7 +26,8 @@ export const LobbyParticipantList = () => {
</Text>
<Button
labelStyle = { styles.allParticipantActionsButton }
- mode = 'text'>
+ mode = 'text'
+ onPress = { admitAll }>
{t('lobby.admitAll')}
</Button>
</View>
diff --git a/react/features/video-menu/actions.any.js b/react/features/video-menu/actions.any.js
index 74ea078ced..c89103243a 100644
--- a/react/features/video-menu/actions.any.js
+++ b/react/features/video-menu/actions.any.js
@@ -23,6 +23,8 @@ import {
getRemoteParticipants,
muteRemoteParticipant
} from '../base/participants';
+import { setKnockingParticipantApproval } from '../lobby/actions';
+import { getLobbyState } from '../lobby/functions';
declare var APP: Object;
@@ -106,3 +108,20 @@ export function muteAllParticipants(exclude: Array<string>, mediaType: MEDIA_TYP
});
};
}
+
+/**
+ * Admit all knocking participants.
+ *
+ * @returns {Function}
+ */
+export function admitAllKnockingParticipants() {
+ return (dispatch: Dispatch<any>, getState: Function) => {
+ const state = getState();
+ const { knockingParticipants, lobbyEnabled } = getLobbyState(state);
+ const knockingParticipantsIds = knockingParticipants.map(participant => participant.id);
+
+ knockingParticipantsIds
+ .map(id => lobbyEnabled && setKnockingParticipantApproval(id, true))
+ .map(dispatch);
+ };
+}