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'
// },
// 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
/**
_immediateReloadThreshold

View File

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

View File

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

View File

@ -40,6 +40,16 @@ type Props = {
*/
_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.
*/
@ -75,7 +85,7 @@ class RemoteVideoMenu extends Component<Props> {
* @inheritdoc
*/
render() {
const { participant } = this.props;
const { _disableKick, _disableRemoteMute, participant } = this.props;
const buttonProps = {
afterClick: this._onCancel,
showLabel: true,
@ -83,6 +93,19 @@ class RemoteVideoMenu extends Component<Props> {
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 (
<BottomSheet onCancel = { this._onCancel }>
<View style = { styles.participantNameContainer }>
@ -93,10 +116,7 @@ class RemoteVideoMenu extends Component<Props> {
{ this.props._participantDisplayName }
</Text>
</View>
<MuteButton { ...buttonProps } />
<KickButton { ...buttonProps } />
<PinButton { ...buttonProps } />
<PrivateMessageButton { ...buttonProps } />
{ buttons }
</BottomSheet>
);
}
@ -130,13 +150,15 @@ class RemoteVideoMenu extends Component<Props> {
*/
function _mapStateToProps(state, ownProps) {
const { participant } = ownProps;
const { remoteVideoMenu = {}, disableRemoteMute } = state['features/base/config'];
const { disableKick } = remoteVideoMenu;
return {
_bottomSheetStyles:
ColorSchemeRegistry.get(state, 'BottomSheet'),
_bottomSheetStyles: ColorSchemeRegistry.get(state, 'BottomSheet'),
_disableKick: Boolean(disableKick),
_disableRemoteMute: Boolean(disableRemoteMute),
_isOpen: isDialogOpen(state, RemoteVideoMenu_),
_participantDisplayName: getParticipantDisplayName(
state, participant.id)
_participantDisplayName: getParticipantDisplayName(state, participant.id)
};
}

View File

@ -26,6 +26,16 @@ declare var interfaceConfig: Object;
*/
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.
*/
@ -157,6 +167,8 @@ class RemoteVideoMenuTriggerButton extends Component<Props> {
*/
_renderRemoteVideoMenu() {
const {
_disableKick,
_disableRemoteMute,
_isModerator,
initialVolumeValue,
isAudioMuted,
@ -169,6 +181,7 @@ class RemoteVideoMenuTriggerButton extends Component<Props> {
const buttons = [];
if (_isModerator) {
if (!_disableRemoteMute) {
buttons.push(
<MuteButton
isAudioMuted = { isAudioMuted }
@ -180,12 +193,16 @@ class RemoteVideoMenuTriggerButton extends Component<Props> {
key = 'mute-others'
participantID = { participantID } />
);
}
if (!_disableKick) {
buttons.push(
<KickButton
key = 'kick'
participantID = { participantID } />
);
}
}
if (remoteControlState) {
buttons.push(
@ -236,9 +253,13 @@ class RemoteVideoMenuTriggerButton extends Component<Props> {
*/
function _mapStateToProps(state) {
const participant = getLocalParticipant(state);
const { remoteVideoMenu = {}, disableRemoteMute } = state['features/base/config'];
const { disableKick } = remoteVideoMenu;
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 isModerator = localParticipant.role === PARTICIPANT_ROLE.MODERATOR;
const { visible } = ownProps;
const { disableRemoteMute } = state['features/base/config'];
return {
isModerator,
localParticipantId: localParticipant.id,
visible: visible && isModerator
visible: visible && isModerator && !disableRemoteMute
};
}