2021-02-24 21:45:07 +00:00
|
|
|
import { Component } from 'react';
|
|
|
|
|
2022-10-10 09:12:02 +00:00
|
|
|
import { IState } from '../../app/types';
|
2021-09-28 16:11:13 +00:00
|
|
|
import { rejectParticipantVideo } from '../../av-moderation/actions';
|
2021-11-03 10:38:12 +00:00
|
|
|
import { isEnabledFromState } from '../../av-moderation/functions';
|
2022-10-10 09:12:02 +00:00
|
|
|
import { MEDIA_TYPE } from '../../base/media/constants';
|
|
|
|
// eslint-disable-next-line lines-around-comment
|
|
|
|
// @ts-ignore
|
2021-02-24 21:45:07 +00:00
|
|
|
import { muteRemote } from '../actions';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} props of
|
|
|
|
* {@link AbstractMuteRemoteParticipantsVideoDialog}.
|
|
|
|
*/
|
|
|
|
export type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The Redux dispatch function.
|
|
|
|
*/
|
2022-10-10 09:12:02 +00:00
|
|
|
dispatch: Function;
|
2021-02-24 21:45:07 +00:00
|
|
|
|
2021-11-03 10:38:12 +00:00
|
|
|
/**
|
|
|
|
* Whether or not video moderation is on.
|
|
|
|
*/
|
2022-10-10 09:12:02 +00:00
|
|
|
isVideoModerationOn: boolean;
|
2021-11-03 10:38:12 +00:00
|
|
|
|
2021-02-24 21:45:07 +00:00
|
|
|
/**
|
|
|
|
* The ID of the remote participant to be muted.
|
|
|
|
*/
|
2022-10-10 09:12:02 +00:00
|
|
|
participantID: string;
|
2021-02-24 21:45:07 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function to translate i18n labels.
|
|
|
|
*/
|
2022-10-10 09:12:02 +00:00
|
|
|
t: Function;
|
2021-02-24 21:45:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Abstract dialog to confirm a remote participant video ute action.
|
|
|
|
*
|
2021-11-04 21:10:43 +00:00
|
|
|
* @augments Component
|
2021-02-24 21:45:07 +00:00
|
|
|
*/
|
2022-10-10 09:12:02 +00:00
|
|
|
export default class AbstractMuteRemoteParticipantsVideoDialog<P extends Props = Props, State=void>
|
2021-09-10 11:05:16 +00:00
|
|
|
extends Component<P, State> {
|
2021-02-24 21:45:07 +00:00
|
|
|
/**
|
|
|
|
* Initializes a new {@code AbstractMuteRemoteParticipantsVideoDialog} instance.
|
|
|
|
*
|
|
|
|
* @param {Object} props - The read-only properties with which the new
|
|
|
|
* instance is to be initialized.
|
|
|
|
*/
|
|
|
|
constructor(props: P) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
// Bind event handlers so they are only bound once per instance.
|
|
|
|
this._onSubmit = this._onSubmit.bind(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles the submit button action.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {boolean} - True (to note that the modal should be closed).
|
|
|
|
*/
|
|
|
|
_onSubmit() {
|
|
|
|
const { dispatch, participantID } = this.props;
|
|
|
|
|
|
|
|
dispatch(muteRemote(participantID, MEDIA_TYPE.VIDEO));
|
2021-09-28 16:11:13 +00:00
|
|
|
dispatch(rejectParticipantVideo(participantID));
|
2021-02-24 21:45:07 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2021-11-03 10:38:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps (parts of) the redux state to the associated
|
|
|
|
* {@code AbstractDialogContainer}'s props.
|
|
|
|
*
|
2022-10-10 09:12:02 +00:00
|
|
|
* @param {IState} state - The redux state.
|
2021-11-03 10:38:12 +00:00
|
|
|
* @private
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
2022-10-10 09:12:02 +00:00
|
|
|
export function abstractMapStateToProps(state: IState) {
|
2021-11-03 10:38:12 +00:00
|
|
|
return {
|
|
|
|
isVideoModerationOn: isEnabledFromState(MEDIA_TYPE.VIDEO, state)
|
|
|
|
};
|
|
|
|
}
|