2017-09-08 15:36:42 +02:00
|
|
|
import React, { Component } from 'react';
|
2023-03-21 09:47:52 +02:00
|
|
|
import { connect } from 'react-redux';
|
2017-09-08 15:36:42 +02:00
|
|
|
|
2023-08-22 15:55:14 -05:00
|
|
|
import { IReduxState, IStore } from '../../../app/types';
|
2023-03-31 14:04:33 +03:00
|
|
|
import ConfirmDialog from '../../../base/dialog/components/native/ConfirmDialog';
|
2023-04-03 13:49:19 +03:00
|
|
|
import { translate } from '../../../base/i18n/functions';
|
2023-08-15 11:46:45 +02:00
|
|
|
import { cancelWaitForOwner, login } from '../../actions.native';
|
|
|
|
|
|
2017-09-08 15:36:42 +02:00
|
|
|
|
|
|
|
|
/**
|
2017-11-17 13:06:47 -06:00
|
|
|
* The type of the React {@code Component} props of {@link WaitForOwnerDialog}.
|
2017-09-08 15:36:42 +02:00
|
|
|
*/
|
2023-04-12 16:58:42 +03:00
|
|
|
interface IProps {
|
2017-11-13 09:54:04 -06:00
|
|
|
|
2023-08-22 15:55:14 -05:00
|
|
|
/**
|
|
|
|
|
* Whether to show alternative cancel button text.
|
|
|
|
|
*/
|
|
|
|
|
_alternativeCancelText?: boolean;
|
|
|
|
|
|
2023-10-02 18:03:57 +03:00
|
|
|
/**
|
|
|
|
|
* Is confirm button hidden?
|
|
|
|
|
*/
|
|
|
|
|
_isConfirmHidden?: boolean;
|
|
|
|
|
|
2017-11-13 09:54:04 -06:00
|
|
|
/**
|
|
|
|
|
* Redux store dispatch function.
|
|
|
|
|
*/
|
2023-04-12 16:58:42 +03:00
|
|
|
dispatch: IStore['dispatch'];
|
2017-09-08 15:36:42 +02:00
|
|
|
|
2017-11-13 09:54:04 -06:00
|
|
|
/**
|
|
|
|
|
* Invoked to obtain translated strings.
|
|
|
|
|
*/
|
2023-04-12 16:58:42 +03:00
|
|
|
t: Function;
|
|
|
|
|
}
|
2017-09-08 15:36:42 +02:00
|
|
|
|
2017-11-13 09:54:04 -06: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.
|
|
|
|
|
*/
|
2023-04-12 16:58:42 +03:00
|
|
|
class WaitForOwnerDialog extends Component<IProps> {
|
2017-09-08 15:36:42 +02:00
|
|
|
/**
|
|
|
|
|
* Initializes a new WaitForWonderDialog instance.
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} props - The read-only properties with which the new
|
|
|
|
|
* instance is to be initialized.
|
|
|
|
|
*/
|
2023-04-12 16:58:42 +03:00
|
|
|
constructor(props: IProps) {
|
2017-09-08 15:36:42 +02:00
|
|
|
super(props);
|
|
|
|
|
|
2017-09-18 02:09:43 -05:00
|
|
|
// Bind event handlers so they are only bound once per instance.
|
2017-09-08 15:36:42 +02:00
|
|
|
this._onCancel = this._onCancel.bind(this);
|
2017-09-18 02:09:43 -05:00
|
|
|
this._onLogin = this._onLogin.bind(this);
|
2017-09-08 15:36:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
|
*
|
|
|
|
|
* @inheritdoc
|
|
|
|
|
* @returns {ReactElement}
|
|
|
|
|
*/
|
2025-03-12 10:19:11 -05:00
|
|
|
override render() {
|
2023-10-02 18:03:57 +03:00
|
|
|
const { _isConfirmHidden } = this.props;
|
|
|
|
|
|
2017-09-08 15:36:42 +02:00
|
|
|
return (
|
2018-10-18 10:30:25 +02:00
|
|
|
<ConfirmDialog
|
2023-08-22 15:55:14 -05:00
|
|
|
cancelLabel = { this.props._alternativeCancelText ? 'dialog.WaitingForHostButton' : 'dialog.Cancel' }
|
2022-02-03 17:45:02 +02:00
|
|
|
confirmLabel = 'dialog.IamHost'
|
2022-03-02 16:28:42 +01:00
|
|
|
descriptionKey = 'dialog.WaitForHostMsg'
|
2023-10-02 18:03:57 +03:00
|
|
|
isConfirmHidden = { _isConfirmHidden }
|
2018-10-18 10:30:25 +02:00
|
|
|
onCancel = { this._onCancel }
|
2022-06-20 11:50:40 +02:00
|
|
|
onSubmit = { this._onLogin } />
|
2017-09-08 15:36:42 +02:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2017-09-18 02:09:43 -05:00
|
|
|
* Called when the cancel button is clicked.
|
2017-09-08 15:36:42 +02:00
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @returns {void}
|
|
|
|
|
*/
|
2017-09-18 02:09:43 -05:00
|
|
|
_onCancel() {
|
|
|
|
|
this.props.dispatch(cancelWaitForOwner());
|
2017-09-08 15:36:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2017-09-18 02:09:43 -05:00
|
|
|
* Called when the OK button is clicked.
|
2017-09-08 15:36:42 +02:00
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @returns {void}
|
|
|
|
|
*/
|
2017-09-18 02:09:43 -05:00
|
|
|
_onLogin() {
|
2023-08-15 11:46:45 +02:00
|
|
|
this.props.dispatch(login());
|
2017-09-18 02:09:43 -05:00
|
|
|
}
|
2017-09-08 15:36:42 +02:00
|
|
|
}
|
|
|
|
|
|
2023-08-22 15:55:14 -05:00
|
|
|
/**
|
|
|
|
|
* Maps (parts of) the redux state to the associated
|
|
|
|
|
* {@code WaitForOwnerDialog}'s props.
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} state - The redux state.
|
|
|
|
|
* @private
|
|
|
|
|
* @returns {IProps}
|
|
|
|
|
*/
|
|
|
|
|
function mapStateToProps(state: IReduxState) {
|
|
|
|
|
const { membersOnly, lobbyWaitingForHost } = state['features/base/conference'];
|
2023-10-02 18:03:57 +03:00
|
|
|
const { locationURL } = state['features/base/connection'];
|
2023-08-22 15:55:14 -05:00
|
|
|
|
|
|
|
|
return {
|
2023-10-02 18:03:57 +03:00
|
|
|
_alternativeCancelText: membersOnly && lobbyWaitingForHost,
|
|
|
|
|
_isConfirmHidden: locationURL?.hostname?.includes('8x8.vc')
|
2023-08-22 15:55:14 -05:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default translate(connect(mapStateToProps)(WaitForOwnerDialog));
|