2017-10-04 22:36:09 +00:00
|
|
|
// @flow
|
|
|
|
|
2017-09-08 13:36:42 +00:00
|
|
|
import React, { Component } from 'react';
|
2019-03-19 15:42:25 +00:00
|
|
|
import type { Dispatch } from 'redux';
|
2017-09-08 13:36:42 +00:00
|
|
|
|
2018-10-18 08:30:25 +00:00
|
|
|
import { ConfirmDialog } from '../../base/dialog';
|
2017-09-08 13:36:42 +00:00
|
|
|
import { translate } from '../../base/i18n';
|
2019-03-21 16:38:29 +00:00
|
|
|
import { connect } from '../../base/redux';
|
2017-09-18 07:09:43 +00:00
|
|
|
|
|
|
|
import { cancelWaitForOwner, _openLoginDialog } from '../actions';
|
2017-09-08 13:36:42 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-17 19:06:47 +00:00
|
|
|
* The type of the React {@code Component} props of {@link WaitForOwnerDialog}.
|
2017-09-08 13:36:42 +00:00
|
|
|
*/
|
2017-11-17 19:06:47 +00:00
|
|
|
type Props = {
|
2017-11-13 15:54:04 +00:00
|
|
|
|
2017-09-08 13:36:42 +00:00
|
|
|
/**
|
2017-11-13 15:54:04 +00:00
|
|
|
* The name of the conference room (without the domain part).
|
2017-09-08 13:36:42 +00:00
|
|
|
*/
|
2017-11-17 19:06:47 +00:00
|
|
|
_room: string,
|
2017-09-08 13:36:42 +00:00
|
|
|
|
2017-11-13 15:54:04 +00:00
|
|
|
/**
|
|
|
|
* Redux store dispatch function.
|
|
|
|
*/
|
2019-03-19 15:42:25 +00:00
|
|
|
dispatch: Dispatch<any>,
|
2017-09-08 13:36:42 +00:00
|
|
|
|
2017-11-13 15:54:04 +00:00
|
|
|
/**
|
|
|
|
* Invoked to obtain translated strings.
|
|
|
|
*/
|
|
|
|
t: Function
|
|
|
|
};
|
2017-09-08 13:36:42 +00:00
|
|
|
|
2017-11-13 15:54:04 +00:00
|
|
|
/**
|
|
|
|
* The dialog is display in XMPP password + guest access configuration, after
|
|
|
|
* user connects from anonymous domain and the conference does not exist yet.
|
|
|
|
*
|
|
|
|
* See {@link LoginDialog} description for more details.
|
|
|
|
*/
|
2017-11-17 19:06:47 +00:00
|
|
|
class WaitForOwnerDialog extends Component<Props> {
|
2017-09-08 13:36:42 +00:00
|
|
|
/**
|
|
|
|
* Initializes a new WaitForWonderDialog instance.
|
|
|
|
*
|
|
|
|
* @param {Object} props - The read-only properties with which the new
|
|
|
|
* instance is to be initialized.
|
|
|
|
*/
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
2017-09-18 07:09:43 +00:00
|
|
|
// Bind event handlers so they are only bound once per instance.
|
2017-09-08 13:36:42 +00:00
|
|
|
this._onCancel = this._onCancel.bind(this);
|
2017-09-18 07:09:43 +00:00
|
|
|
this._onLogin = this._onLogin.bind(this);
|
2017-09-08 13:36:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
|
|
|
const {
|
2018-10-18 08:30:25 +00:00
|
|
|
_room: room
|
2017-09-08 13:36:42 +00:00
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
return (
|
2018-10-18 08:30:25 +00:00
|
|
|
<ConfirmDialog
|
2019-05-24 09:26:31 +00:00
|
|
|
cancelKey = 'dialog.Cancel'
|
2018-10-18 08:30:25 +00:00
|
|
|
contentKey = {
|
2017-09-18 07:09:43 +00:00
|
|
|
{
|
2018-10-18 08:30:25 +00:00
|
|
|
key: 'dialog.WaitForHostMsgWOk',
|
|
|
|
params: { room }
|
2017-09-18 07:09:43 +00:00
|
|
|
}
|
2018-10-18 08:30:25 +00:00
|
|
|
}
|
2019-05-24 09:26:31 +00:00
|
|
|
okKey = 'dialog.Ok'
|
2018-10-18 08:30:25 +00:00
|
|
|
onCancel = { this._onCancel }
|
|
|
|
onSubmit = { this._onLogin } />
|
2017-09-08 13:36:42 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-10-30 15:24:11 +00:00
|
|
|
_onCancel: () => void;
|
|
|
|
|
2017-09-08 13:36:42 +00:00
|
|
|
/**
|
2017-09-18 07:09:43 +00:00
|
|
|
* Called when the cancel button is clicked.
|
2017-09-08 13:36:42 +00:00
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2017-09-18 07:09:43 +00:00
|
|
|
_onCancel() {
|
|
|
|
this.props.dispatch(cancelWaitForOwner());
|
2017-09-08 13:36:42 +00:00
|
|
|
}
|
|
|
|
|
2017-10-30 15:24:11 +00:00
|
|
|
_onLogin: () => void;
|
|
|
|
|
2017-09-08 13:36:42 +00:00
|
|
|
/**
|
2017-09-18 07:09:43 +00:00
|
|
|
* Called when the OK button is clicked.
|
2017-09-08 13:36:42 +00:00
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2017-09-18 07:09:43 +00:00
|
|
|
_onLogin() {
|
|
|
|
this.props.dispatch(_openLoginDialog());
|
|
|
|
}
|
2017-09-08 13:36:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps (parts of) the Redux state to the associated props for the
|
|
|
|
* {@code WaitForOwnerDialog} component.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
|
|
|
* @private
|
|
|
|
* @returns {{
|
2017-09-18 07:09:43 +00:00
|
|
|
* _room: string
|
2017-09-08 13:36:42 +00:00
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
function _mapStateToProps(state) {
|
2017-10-04 22:36:09 +00:00
|
|
|
const { authRequired } = state['features/base/conference'];
|
2017-09-08 13:36:42 +00:00
|
|
|
|
|
|
|
return {
|
2017-09-18 07:09:43 +00:00
|
|
|
_room: authRequired && authRequired.getName()
|
2017-09-08 13:36:42 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default translate(connect(_mapStateToProps)(WaitForOwnerDialog));
|