2020-04-16 10:47:10 +00:00
|
|
|
// @flow
|
|
|
|
|
2020-05-07 07:42:55 +00:00
|
|
|
import InlineDialog from '@atlaskit/inline-dialog';
|
2020-05-20 10:57:03 +00:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
|
|
|
import { getRoomName } from '../../base/conference';
|
|
|
|
import { translate } from '../../base/i18n';
|
|
|
|
import { Icon, IconPhone, IconVolumeOff } from '../../base/icons';
|
2020-06-19 07:03:26 +00:00
|
|
|
import { isVideoMutedByUser } from '../../base/media';
|
2020-05-20 08:25:31 +00:00
|
|
|
import { ActionButton, InputField, PreMeetingScreen } from '../../base/premeeting';
|
2020-05-20 10:57:03 +00:00
|
|
|
import { connect } from '../../base/redux';
|
|
|
|
import { getDisplayName, updateSettings } from '../../base/settings';
|
2020-06-19 07:03:26 +00:00
|
|
|
import { getLocalJitsiVideoTrack } from '../../base/tracks';
|
2020-04-16 10:47:10 +00:00
|
|
|
import {
|
|
|
|
joinConference as joinConferenceAction,
|
|
|
|
joinConferenceWithoutAudio as joinConferenceWithoutAudioAction,
|
2020-05-07 07:42:55 +00:00
|
|
|
setSkipPrejoin as setSkipPrejoinAction,
|
|
|
|
setJoinByPhoneDialogVisiblity as setJoinByPhoneDialogVisiblityAction
|
2020-04-16 10:47:10 +00:00
|
|
|
} from '../actions';
|
|
|
|
import {
|
2020-05-19 07:52:57 +00:00
|
|
|
isJoinByPhoneButtonVisible,
|
2020-04-16 10:47:10 +00:00
|
|
|
isDeviceStatusVisible,
|
2020-06-19 07:03:26 +00:00
|
|
|
isJoinByPhoneDialogVisible
|
2020-04-16 10:47:10 +00:00
|
|
|
} from '../functions';
|
2020-05-20 10:57:03 +00:00
|
|
|
|
|
|
|
import JoinByPhoneDialog from './dialogs/JoinByPhoneDialog';
|
2020-04-16 10:47:10 +00:00
|
|
|
import DeviceStatus from './preview/DeviceStatus';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Flag signaling if the device status is visible or not.
|
|
|
|
*/
|
|
|
|
deviceStatusVisible: boolean,
|
|
|
|
|
2020-05-19 07:52:57 +00:00
|
|
|
/**
|
|
|
|
* If join by phone button should be visible.
|
|
|
|
*/
|
|
|
|
hasJoinByPhoneButton: boolean,
|
|
|
|
|
2020-04-16 10:47:10 +00:00
|
|
|
/**
|
|
|
|
* Joins the current meeting.
|
|
|
|
*/
|
|
|
|
joinConference: Function,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Joins the current meeting without audio.
|
|
|
|
*/
|
|
|
|
joinConferenceWithoutAudio: Function,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The name of the user that is about to join.
|
|
|
|
*/
|
|
|
|
name: string,
|
|
|
|
|
|
|
|
/**
|
2020-05-07 07:42:55 +00:00
|
|
|
* Updates settings.
|
2020-04-16 10:47:10 +00:00
|
|
|
*/
|
2020-05-07 07:42:55 +00:00
|
|
|
updateSettings: Function,
|
2020-04-16 10:47:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The name of the meeting that is about to be joined.
|
|
|
|
*/
|
|
|
|
roomName: string,
|
|
|
|
|
|
|
|
/**
|
2020-05-07 07:42:55 +00:00
|
|
|
* Sets visibility of the prejoin page for the next sessions.
|
|
|
|
*/
|
|
|
|
setSkipPrejoin: Function,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets visibility of the 'JoinByPhoneDialog'.
|
2020-04-16 10:47:10 +00:00
|
|
|
*/
|
|
|
|
setJoinByPhoneDialogVisiblity: Function,
|
|
|
|
|
2020-05-20 08:25:31 +00:00
|
|
|
/**
|
|
|
|
* Flag signaling the visibility of camera preview.
|
|
|
|
*/
|
|
|
|
showCameraPreview: boolean,
|
|
|
|
|
2020-04-16 10:47:10 +00:00
|
|
|
/**
|
|
|
|
* If 'JoinByPhoneDialog' is visible or not.
|
|
|
|
*/
|
|
|
|
showDialog: boolean,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Used for translation.
|
|
|
|
*/
|
|
|
|
t: Function,
|
2020-05-20 08:25:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The JitsiLocalTrack to display.
|
|
|
|
*/
|
|
|
|
videoTrack: ?Object,
|
2020-04-16 10:47:10 +00:00
|
|
|
};
|
|
|
|
|
2020-05-07 07:42:55 +00:00
|
|
|
type State = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Flag controlling the visibility of the 'join by phone' buttons.
|
|
|
|
*/
|
|
|
|
showJoinByPhoneButtons: boolean
|
|
|
|
}
|
|
|
|
|
2020-04-16 10:47:10 +00:00
|
|
|
/**
|
|
|
|
* This component is displayed before joining a meeting.
|
|
|
|
*/
|
2020-05-07 07:42:55 +00:00
|
|
|
class Prejoin extends Component<Props, State> {
|
2020-04-16 10:47:10 +00:00
|
|
|
/**
|
|
|
|
* Initializes a new {@code Prejoin} instance.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
2020-05-07 07:42:55 +00:00
|
|
|
this.state = {
|
|
|
|
showJoinByPhoneButtons: false
|
|
|
|
};
|
2020-05-14 12:30:24 +00:00
|
|
|
|
|
|
|
this._closeDialog = this._closeDialog.bind(this);
|
2020-04-16 10:47:10 +00:00
|
|
|
this._showDialog = this._showDialog.bind(this);
|
2020-05-07 07:42:55 +00:00
|
|
|
this._onCheckboxChange = this._onCheckboxChange.bind(this);
|
|
|
|
this._onDropdownClose = this._onDropdownClose.bind(this);
|
|
|
|
this._onOptionsClick = this._onOptionsClick.bind(this);
|
|
|
|
this._setName = this._setName.bind(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
_onCheckboxChange: () => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handler for the checkbox.
|
|
|
|
*
|
|
|
|
* @param {Object} e - The synthetic event.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onCheckboxChange(e) {
|
|
|
|
this.props.setSkipPrejoin(e.target.checked);
|
|
|
|
}
|
|
|
|
|
|
|
|
_onDropdownClose: () => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Closes the dropdown.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onDropdownClose() {
|
|
|
|
this.setState({
|
|
|
|
showJoinByPhoneButtons: false
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_onOptionsClick: () => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Displays the join by phone buttons dropdown.
|
|
|
|
*
|
|
|
|
* @param {Object} e - The synthetic event.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onOptionsClick(e) {
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
showJoinByPhoneButtons: !this.state.showJoinByPhoneButtons
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_setName: () => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the guest participant name.
|
|
|
|
*
|
|
|
|
* @param {string} displayName - Participant name.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_setName(displayName) {
|
|
|
|
this.props.updateSettings({
|
|
|
|
displayName
|
|
|
|
});
|
2020-04-16 10:47:10 +00:00
|
|
|
}
|
|
|
|
|
2020-05-14 12:30:24 +00:00
|
|
|
_closeDialog: () => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Closes the join by phone dialog.
|
|
|
|
*
|
|
|
|
* @returns {undefined}
|
|
|
|
*/
|
|
|
|
_closeDialog() {
|
|
|
|
this.props.setJoinByPhoneDialogVisiblity(false);
|
|
|
|
}
|
|
|
|
|
2020-04-16 10:47:10 +00:00
|
|
|
_showDialog: () => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Displays the dialog for joining a meeting by phone.
|
|
|
|
*
|
|
|
|
* @returns {undefined}
|
|
|
|
*/
|
|
|
|
_showDialog() {
|
|
|
|
this.props.setJoinByPhoneDialogVisiblity(true);
|
2020-05-14 12:30:24 +00:00
|
|
|
this._onDropdownClose();
|
2020-04-16 10:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
|
|
|
const {
|
2020-05-19 07:52:57 +00:00
|
|
|
hasJoinByPhoneButton,
|
2020-04-16 10:47:10 +00:00
|
|
|
joinConference,
|
|
|
|
joinConferenceWithoutAudio,
|
|
|
|
name,
|
2020-05-20 08:25:31 +00:00
|
|
|
showCameraPreview,
|
2020-05-14 12:30:24 +00:00
|
|
|
showDialog,
|
2020-05-20 08:25:31 +00:00
|
|
|
t,
|
|
|
|
videoTrack
|
2020-04-16 10:47:10 +00:00
|
|
|
} = this.props;
|
2020-05-14 12:30:24 +00:00
|
|
|
|
|
|
|
const { _closeDialog, _onCheckboxChange, _onDropdownClose, _onOptionsClick, _setName, _showDialog } = this;
|
2020-05-07 07:42:55 +00:00
|
|
|
const { showJoinByPhoneButtons } = this.state;
|
2020-04-16 10:47:10 +00:00
|
|
|
|
|
|
|
return (
|
2020-05-20 08:25:31 +00:00
|
|
|
<PreMeetingScreen
|
|
|
|
footer = { this._renderFooter() }
|
|
|
|
title = { t('prejoin.joinMeeting') }
|
|
|
|
videoMuted = { !showCameraPreview }
|
|
|
|
videoTrack = { videoTrack }>
|
2020-04-16 10:47:10 +00:00
|
|
|
<div className = 'prejoin-input-area-container'>
|
|
|
|
<div className = 'prejoin-input-area'>
|
2020-05-20 08:25:31 +00:00
|
|
|
<InputField
|
|
|
|
onChange = { _setName }
|
|
|
|
onSubmit = { joinConference }
|
|
|
|
placeHolder = { t('dialog.enterDisplayName') }
|
2020-04-16 10:47:10 +00:00
|
|
|
value = { name } />
|
2020-05-07 07:42:55 +00:00
|
|
|
|
|
|
|
<div className = 'prejoin-preview-dropdown-container'>
|
|
|
|
<InlineDialog
|
|
|
|
content = { <div className = 'prejoin-preview-dropdown-btns'>
|
|
|
|
<div
|
|
|
|
className = 'prejoin-preview-dropdown-btn'
|
|
|
|
onClick = { joinConferenceWithoutAudio }>
|
|
|
|
<Icon
|
|
|
|
className = 'prejoin-preview-dropdown-icon'
|
|
|
|
size = { 24 }
|
|
|
|
src = { IconVolumeOff } />
|
|
|
|
{ t('prejoin.joinWithoutAudio') }
|
|
|
|
</div>
|
2020-05-19 07:52:57 +00:00
|
|
|
{hasJoinByPhoneButton && <div
|
2020-05-07 07:42:55 +00:00
|
|
|
className = 'prejoin-preview-dropdown-btn'
|
|
|
|
onClick = { _showDialog }>
|
|
|
|
<Icon
|
|
|
|
className = 'prejoin-preview-dropdown-icon'
|
|
|
|
size = { 24 }
|
|
|
|
src = { IconPhone } />
|
|
|
|
{ t('prejoin.joinAudioByPhone') }
|
2020-05-19 07:52:57 +00:00
|
|
|
</div>}
|
2020-05-07 07:42:55 +00:00
|
|
|
</div> }
|
|
|
|
isOpen = { showJoinByPhoneButtons }
|
|
|
|
onClose = { _onDropdownClose }>
|
2020-04-16 10:47:10 +00:00
|
|
|
<ActionButton
|
2020-05-19 07:52:57 +00:00
|
|
|
disabled = { !name }
|
|
|
|
hasOptions = { true }
|
2020-05-07 07:42:55 +00:00
|
|
|
onClick = { joinConference }
|
|
|
|
onOptionsClick = { _onOptionsClick }
|
|
|
|
type = 'primary'>
|
|
|
|
{ t('prejoin.joinMeeting') }
|
2020-04-16 10:47:10 +00:00
|
|
|
</ActionButton>
|
2020-05-07 07:42:55 +00:00
|
|
|
</InlineDialog>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className = 'prejoin-checkbox-container'>
|
|
|
|
<input
|
|
|
|
className = 'prejoin-checkbox'
|
|
|
|
onChange = { _onCheckboxChange }
|
|
|
|
type = 'checkbox' />
|
|
|
|
<span>{t('prejoin.doNotShow')}</span>
|
2020-04-16 10:47:10 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-05-14 12:30:24 +00:00
|
|
|
{ showDialog && (
|
|
|
|
<JoinByPhoneDialog
|
|
|
|
joinConferenceWithoutAudio = { joinConferenceWithoutAudio }
|
|
|
|
onClose = { _closeDialog } />
|
|
|
|
)}
|
2020-05-20 08:25:31 +00:00
|
|
|
</PreMeetingScreen>
|
2020-04-16 10:47:10 +00:00
|
|
|
);
|
|
|
|
}
|
2020-05-20 08:25:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders the screen footer if any.
|
|
|
|
*
|
|
|
|
* @returns {React$Element}
|
|
|
|
*/
|
|
|
|
_renderFooter() {
|
|
|
|
return this.props.deviceStatusVisible && <DeviceStatus />;
|
|
|
|
}
|
2020-04-16 10:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps (parts of) the redux state to the React {@code Component} props.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The redux state.
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
function mapStateToProps(state): Object {
|
|
|
|
return {
|
|
|
|
deviceStatusVisible: isDeviceStatusVisible(state),
|
2020-05-07 07:42:55 +00:00
|
|
|
name: getDisplayName(state),
|
2020-04-16 10:47:10 +00:00
|
|
|
roomName: getRoomName(state),
|
|
|
|
showDialog: isJoinByPhoneDialogVisible(state),
|
2020-05-20 08:25:31 +00:00
|
|
|
hasJoinByPhoneButton: isJoinByPhoneButtonVisible(state),
|
2020-06-19 07:03:26 +00:00
|
|
|
showCameraPreview: !isVideoMutedByUser(state),
|
|
|
|
videoTrack: getLocalJitsiVideoTrack(state)
|
2020-04-16 10:47:10 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
const mapDispatchToProps = {
|
|
|
|
joinConferenceWithoutAudio: joinConferenceWithoutAudioAction,
|
|
|
|
joinConference: joinConferenceAction,
|
|
|
|
setJoinByPhoneDialogVisiblity: setJoinByPhoneDialogVisiblityAction,
|
2020-05-07 07:42:55 +00:00
|
|
|
setSkipPrejoin: setSkipPrejoinAction,
|
|
|
|
updateSettings
|
2020-04-16 10:47:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(translate(Prejoin));
|