feat(remote-menu):option for disable mute and kick

This commit is contained in:
Hristo Terezov 2020-03-25 16:28:31 -05:00
parent a46fd60788
commit 3a871cbed8
6 changed files with 85 additions and 28 deletions

View File

@ -459,6 +459,15 @@ var config = {
// downloadAppsUrl: 'https://docs.example.com/our-apps.html' // downloadAppsUrl: 'https://docs.example.com/our-apps.html'
// }, // },
// Options related to the remote participant menu.
// remoteVideoMenu: {
// // If set to true the 'Kick out' button will be disabled.
// disableKick: true
// },
// If set to true all muting operations of remote participants will be disabled.
// disableRemoteMute: true,
// List of undocumented settings used in jitsi-meet // List of undocumented settings used in jitsi-meet
/** /**
_immediateReloadThreshold _immediateReloadThreshold

View File

@ -88,6 +88,7 @@ export default [
'disableLocalVideoFlip', 'disableLocalVideoFlip',
'disableNS', 'disableNS',
'disableRemoteControl', 'disableRemoteControl',
'disableRemoteMute',
'disableRtx', 'disableRtx',
'disableSuspendVideo', 'disableSuspendVideo',
'disableThirdPartyRequests', 'disableThirdPartyRequests',
@ -126,6 +127,7 @@ export default [
'pcStatsInterval', 'pcStatsInterval',
'preferH264', 'preferH264',
'requireDisplayName', 'requireDisplayName',
'remoteVideoMenu',
'resolution', 'resolution',
'startAudioMuted', 'startAudioMuted',
'startAudioOnly', 'startAudioOnly',

View File

@ -43,7 +43,9 @@ const INITIAL_RN_STATE = {
p2p: { p2p: {
disableH264: false, disableH264: false,
preferH264: true preferH264: true
} },
remoteVideoMenu: {}
}; };
ReducerRegistry.register('features/base/config', (state = _getInitialState(), action) => { ReducerRegistry.register('features/base/config', (state = _getInitialState(), action) => {

View File

@ -40,6 +40,16 @@ type Props = {
*/ */
_bottomSheetStyles: StyleType, _bottomSheetStyles: StyleType,
/**
* Whether or not to display the kick button.
*/
_disableKick: boolean,
/**
* Whether or not to display the remote mute buttons.
*/
_disableRemoteMute: boolean,
/** /**
* True if the menu is currently open, false otherwise. * True if the menu is currently open, false otherwise.
*/ */
@ -75,7 +85,7 @@ class RemoteVideoMenu extends Component<Props> {
* @inheritdoc * @inheritdoc
*/ */
render() { render() {
const { participant } = this.props; const { _disableKick, _disableRemoteMute, participant } = this.props;
const buttonProps = { const buttonProps = {
afterClick: this._onCancel, afterClick: this._onCancel,
showLabel: true, showLabel: true,
@ -83,6 +93,19 @@ class RemoteVideoMenu extends Component<Props> {
styles: this.props._bottomSheetStyles.buttons styles: this.props._bottomSheetStyles.buttons
}; };
const buttons = [];
if (!_disableRemoteMute) {
buttons.push(<MuteButton { ...buttonProps } />);
}
if (!_disableKick) {
buttons.push(<KickButton { ...buttonProps } />);
}
buttons.push(<PinButton { ...buttonProps } />);
buttons.push(<PrivateMessageButton { ...buttonProps } />);
return ( return (
<BottomSheet onCancel = { this._onCancel }> <BottomSheet onCancel = { this._onCancel }>
<View style = { styles.participantNameContainer }> <View style = { styles.participantNameContainer }>
@ -93,10 +116,7 @@ class RemoteVideoMenu extends Component<Props> {
{ this.props._participantDisplayName } { this.props._participantDisplayName }
</Text> </Text>
</View> </View>
<MuteButton { ...buttonProps } /> { buttons }
<KickButton { ...buttonProps } />
<PinButton { ...buttonProps } />
<PrivateMessageButton { ...buttonProps } />
</BottomSheet> </BottomSheet>
); );
} }
@ -130,13 +150,15 @@ class RemoteVideoMenu extends Component<Props> {
*/ */
function _mapStateToProps(state, ownProps) { function _mapStateToProps(state, ownProps) {
const { participant } = ownProps; const { participant } = ownProps;
const { remoteVideoMenu = {}, disableRemoteMute } = state['features/base/config'];
const { disableKick } = remoteVideoMenu;
return { return {
_bottomSheetStyles: _bottomSheetStyles: ColorSchemeRegistry.get(state, 'BottomSheet'),
ColorSchemeRegistry.get(state, 'BottomSheet'), _disableKick: Boolean(disableKick),
_disableRemoteMute: Boolean(disableRemoteMute),
_isOpen: isDialogOpen(state, RemoteVideoMenu_), _isOpen: isDialogOpen(state, RemoteVideoMenu_),
_participantDisplayName: getParticipantDisplayName( _participantDisplayName: getParticipantDisplayName(state, participant.id)
state, participant.id)
}; };
} }

View File

@ -26,6 +26,16 @@ declare var interfaceConfig: Object;
*/ */
type Props = { type Props = {
/**
* Whether or not to display the kick button.
*/
_disableKick: boolean,
/**
* Whether or not to display the remote mute buttons.
*/
_disableRemoteMute: Boolean,
/** /**
* Whether or not the participant is a conference moderator. * Whether or not the participant is a conference moderator.
*/ */
@ -157,6 +167,8 @@ class RemoteVideoMenuTriggerButton extends Component<Props> {
*/ */
_renderRemoteVideoMenu() { _renderRemoteVideoMenu() {
const { const {
_disableKick,
_disableRemoteMute,
_isModerator, _isModerator,
initialVolumeValue, initialVolumeValue,
isAudioMuted, isAudioMuted,
@ -169,6 +181,7 @@ class RemoteVideoMenuTriggerButton extends Component<Props> {
const buttons = []; const buttons = [];
if (_isModerator) { if (_isModerator) {
if (!_disableRemoteMute) {
buttons.push( buttons.push(
<MuteButton <MuteButton
isAudioMuted = { isAudioMuted } isAudioMuted = { isAudioMuted }
@ -180,12 +193,16 @@ class RemoteVideoMenuTriggerButton extends Component<Props> {
key = 'mute-others' key = 'mute-others'
participantID = { participantID } /> participantID = { participantID } />
); );
}
if (!_disableKick) {
buttons.push( buttons.push(
<KickButton <KickButton
key = 'kick' key = 'kick'
participantID = { participantID } /> participantID = { participantID } />
); );
} }
}
if (remoteControlState) { if (remoteControlState) {
buttons.push( buttons.push(
@ -236,9 +253,13 @@ class RemoteVideoMenuTriggerButton extends Component<Props> {
*/ */
function _mapStateToProps(state) { function _mapStateToProps(state) {
const participant = getLocalParticipant(state); const participant = getLocalParticipant(state);
const { remoteVideoMenu = {}, disableRemoteMute } = state['features/base/config'];
const { disableKick } = remoteVideoMenu;
return { return {
_isModerator: Boolean(participant?.role === PARTICIPANT_ROLE.MODERATOR) _isModerator: Boolean(participant?.role === PARTICIPANT_ROLE.MODERATOR),
_disableKick: Boolean(disableKick),
_disableRemoteMute: Boolean(disableRemoteMute)
}; };
} }

View File

@ -64,11 +64,12 @@ function _mapStateToProps(state: Object, ownProps: Props) {
const localParticipant = getLocalParticipant(state); const localParticipant = getLocalParticipant(state);
const isModerator = localParticipant.role === PARTICIPANT_ROLE.MODERATOR; const isModerator = localParticipant.role === PARTICIPANT_ROLE.MODERATOR;
const { visible } = ownProps; const { visible } = ownProps;
const { disableRemoteMute } = state['features/base/config'];
return { return {
isModerator, isModerator,
localParticipantId: localParticipant.id, localParticipantId: localParticipant.id,
visible: visible && isModerator visible: visible && isModerator && !disableRemoteMute
}; };
} }