feat(native-participants-pane) created admitAll action
This commit is contained in:
parent
ba9398a1e2
commit
4b72fefd7e
|
@ -1,28 +1,5 @@
|
||||||
// @flow
|
// @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.
|
* Selector to return lobby state.
|
||||||
*
|
*
|
||||||
|
|
|
@ -14,8 +14,7 @@ import {
|
||||||
} from '../../../base/icons';
|
} from '../../../base/icons';
|
||||||
import { MEDIA_TYPE } from '../../../base/media';
|
import { MEDIA_TYPE } from '../../../base/media';
|
||||||
import {
|
import {
|
||||||
muteAllParticipants,
|
muteAllParticipants
|
||||||
unmuteDisabled
|
|
||||||
} from '../../../video-menu/actions.any';
|
} from '../../../video-menu/actions.any';
|
||||||
|
|
||||||
import styles from './styles';
|
import styles from './styles';
|
||||||
|
@ -35,7 +34,6 @@ type Props = {
|
||||||
export const ContextMenuMore = ({ exclude }: Props) => {
|
export const ContextMenuMore = ({ exclude }: Props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const cancel = useCallback(() => dispatch(hideDialog()), [ dispatch ]);
|
const cancel = useCallback(() => dispatch(hideDialog()), [ dispatch ]);
|
||||||
const unMuteDisabled = useCallback(() => dispatch(unmuteDisabled()), [ dispatch ]);
|
|
||||||
const muteEveryoneVideo = useCallback(() => dispatch(muteAllParticipants(exclude, MEDIA_TYPE.VIDEO)), [ dispatch ]);
|
const muteEveryoneVideo = useCallback(() => dispatch(muteAllParticipants(exclude, MEDIA_TYPE.VIDEO)), [ dispatch ]);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
@ -52,7 +50,6 @@ export const ContextMenuMore = ({ exclude }: Props) => {
|
||||||
<Text style = { styles.contextMenuItemText }>{t('participantsPane.actions.stopEveryonesVideo')}</Text>
|
<Text style = { styles.contextMenuItemText }>{t('participantsPane.actions.stopEveryonesVideo')}</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
onPress = { unMuteDisabled }
|
|
||||||
style = { styles.contextMenuItem }>
|
style = { styles.contextMenuItem }>
|
||||||
<Icon
|
<Icon
|
||||||
size = { 24 }
|
size = { 24 }
|
||||||
|
|
|
@ -1,15 +1,20 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Text, View } from 'react-native';
|
import { Text, View } from 'react-native';
|
||||||
import { Button } from 'react-native-paper';
|
import { Button } from 'react-native-paper';
|
||||||
|
import { useDispatch } from 'react-redux';
|
||||||
|
|
||||||
|
import { admitAllKnockingParticipants } from '../../../video-menu/actions.any';
|
||||||
|
|
||||||
import { LobbyParticipantItem } from './LobbyParticipantItem';
|
import { LobbyParticipantItem } from './LobbyParticipantItem';
|
||||||
import { participants } from './participants';
|
import { participants } from './participants';
|
||||||
import styles from './styles';
|
import styles from './styles';
|
||||||
|
|
||||||
export const LobbyParticipantList = () => {
|
export const LobbyParticipantList = () => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const admitAll = useCallback(() => dispatch(admitAllKnockingParticipants()), [ dispatch ]);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -21,7 +26,8 @@ export const LobbyParticipantList = () => {
|
||||||
</Text>
|
</Text>
|
||||||
<Button
|
<Button
|
||||||
labelStyle = { styles.allParticipantActionsButton }
|
labelStyle = { styles.allParticipantActionsButton }
|
||||||
mode = 'text'>
|
mode = 'text'
|
||||||
|
onPress = { admitAll }>
|
||||||
{t('lobby.admitAll')}
|
{t('lobby.admitAll')}
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -23,6 +23,8 @@ import {
|
||||||
getRemoteParticipants,
|
getRemoteParticipants,
|
||||||
muteRemoteParticipant
|
muteRemoteParticipant
|
||||||
} from '../base/participants';
|
} from '../base/participants';
|
||||||
|
import { setKnockingParticipantApproval } from '../lobby/actions';
|
||||||
|
import { getLobbyState } from '../lobby/functions';
|
||||||
|
|
||||||
declare var APP: Object;
|
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);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue