2019-04-02 13:16:52 +00:00
|
|
|
// @flow
|
2018-10-30 05:02:23 +00:00
|
|
|
|
2018-02-13 19:46:47 +00:00
|
|
|
import React, { Component } from 'react';
|
2019-03-19 15:42:25 +00:00
|
|
|
import type { Dispatch } from 'redux';
|
2018-02-13 19:46:47 +00:00
|
|
|
|
2019-04-02 13:16:52 +00:00
|
|
|
import { setPassword } from '../../../../base/conference';
|
|
|
|
import { getInviteURL } from '../../../../base/connection';
|
|
|
|
import { Dialog } from '../../../../base/dialog';
|
|
|
|
import { translate } from '../../../../base/i18n';
|
2019-08-30 16:39:06 +00:00
|
|
|
import { Icon, IconInfo } from '../../../../base/icons';
|
2019-04-02 13:16:52 +00:00
|
|
|
import { connect } from '../../../../base/redux';
|
2019-05-09 08:37:21 +00:00
|
|
|
import {
|
|
|
|
isLocalParticipantModerator,
|
|
|
|
getLocalParticipant
|
|
|
|
} from '../../../../base/participants';
|
2018-02-13 19:46:47 +00:00
|
|
|
|
2019-07-10 17:27:11 +00:00
|
|
|
import {
|
|
|
|
_decodeRoomURI,
|
|
|
|
_getDefaultPhoneNumber,
|
|
|
|
getDialInfoPageURL
|
|
|
|
} from '../../../functions';
|
2019-08-21 14:50:00 +00:00
|
|
|
import logger from '../../../logger';
|
2018-02-13 19:46:47 +00:00
|
|
|
import DialInNumber from './DialInNumber';
|
|
|
|
import PasswordForm from './PasswordForm';
|
|
|
|
|
2019-08-30 16:39:06 +00:00
|
|
|
|
2018-02-13 19:46:47 +00:00
|
|
|
/**
|
2018-10-30 05:02:23 +00:00
|
|
|
* The type of the React {@code Component} props of {@link InfoDialog}.
|
2018-02-13 19:46:47 +00:00
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
type Props = {
|
|
|
|
|
2018-02-13 19:46:47 +00:00
|
|
|
/**
|
2018-10-30 05:02:23 +00:00
|
|
|
* Whether or not the current user can modify the current password.
|
2018-02-13 19:46:47 +00:00
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
_canEditPassword: boolean,
|
2018-02-13 19:46:47 +00:00
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* The JitsiConference for which to display a lock state and change the
|
|
|
|
* password.
|
|
|
|
*/
|
|
|
|
_conference: Object,
|
2018-02-13 19:46:47 +00:00
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* The name of the current conference. Used as part of inviting users.
|
|
|
|
*/
|
|
|
|
_conferenceName: string,
|
2018-02-13 19:46:47 +00:00
|
|
|
|
2019-05-22 07:43:17 +00:00
|
|
|
/**
|
|
|
|
* The number of digits to be used in the password.
|
|
|
|
*/
|
|
|
|
_passwordNumberOfDigits: ?number,
|
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* The current url of the conference to be copied onto the clipboard.
|
|
|
|
*/
|
|
|
|
_inviteURL: string,
|
2018-02-13 19:46:47 +00:00
|
|
|
|
2019-05-09 08:37:21 +00:00
|
|
|
/**
|
|
|
|
* The redux representation of the local participant.
|
|
|
|
*/
|
|
|
|
_localParticipant: Object,
|
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* The current location url of the conference.
|
|
|
|
*/
|
|
|
|
_locationURL: Object,
|
2018-09-07 22:48:58 +00:00
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* The value for how the conference is locked (or undefined if not locked)
|
|
|
|
* as defined by room-lock constants.
|
|
|
|
*/
|
|
|
|
_locked: string,
|
2018-02-13 19:46:47 +00:00
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* The current known password for the JitsiConference.
|
|
|
|
*/
|
|
|
|
_password: string,
|
2018-02-13 19:46:47 +00:00
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* The object representing the dialIn feature.
|
|
|
|
*/
|
|
|
|
dialIn: Object,
|
2018-03-07 00:28:19 +00:00
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* Invoked to open a dialog for adding participants to the conference.
|
|
|
|
*/
|
2019-03-19 15:42:25 +00:00
|
|
|
dispatch: Dispatch<any>,
|
2018-02-13 19:46:47 +00:00
|
|
|
|
2019-03-05 14:26:45 +00:00
|
|
|
/**
|
|
|
|
* Whether is Atlaskit InlineDialog or a normal dialog.
|
|
|
|
*/
|
|
|
|
isInlineDialog: boolean,
|
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* The current known URL for a live stream in progress.
|
|
|
|
*/
|
|
|
|
liveStreamViewURL: string,
|
2018-04-20 17:28:16 +00:00
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* Callback invoked when the dialog should be closed.
|
|
|
|
*/
|
|
|
|
onClose: Function,
|
2018-02-13 19:46:47 +00:00
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* Callback invoked when a mouse-related event has been detected.
|
|
|
|
*/
|
|
|
|
onMouseOver: Function,
|
2018-02-13 19:46:47 +00:00
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* Invoked to obtain translated strings.
|
|
|
|
*/
|
|
|
|
t: Function
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} state of {@link InfoDialog}.
|
|
|
|
*/
|
|
|
|
type State = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether or not to show the password in editing mode.
|
|
|
|
*/
|
|
|
|
passwordEditEnabled: boolean,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The conference dial-in number to display.
|
|
|
|
*/
|
|
|
|
phoneNumber: ?string
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A React Component with the contents for a dialog that shows information about
|
|
|
|
* the current conference.
|
|
|
|
*
|
|
|
|
* @extends Component
|
|
|
|
*/
|
|
|
|
class InfoDialog extends Component<Props, State> {
|
|
|
|
_copyElement: ?Object;
|
2018-02-13 19:46:47 +00:00
|
|
|
|
2018-10-29 02:10:51 +00:00
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#getDerivedStateFromProps()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
static getDerivedStateFromProps(props, state) {
|
|
|
|
let phoneNumber = state.phoneNumber;
|
|
|
|
|
|
|
|
if (!state.phoneNumber && props.dialIn.numbers) {
|
2019-03-22 23:03:18 +00:00
|
|
|
phoneNumber = _getDefaultPhoneNumber(props.dialIn.numbers);
|
2018-10-29 02:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
// Exit edit mode when a password is set locally or remotely.
|
|
|
|
passwordEditEnabled: state.passwordEditEnabled && props._password
|
|
|
|
? false : state.passwordEditEnabled,
|
|
|
|
phoneNumber
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-02-13 19:46:47 +00:00
|
|
|
/**
|
|
|
|
* {@code InfoDialog} component's local state.
|
|
|
|
*
|
|
|
|
* @type {Object}
|
|
|
|
* @property {boolean} passwordEditEnabled - Whether or not to show the
|
|
|
|
* {@code PasswordForm} in its editing state.
|
|
|
|
* @property {string} phoneNumber - The number to display for dialing into
|
|
|
|
* the conference.
|
|
|
|
*/
|
|
|
|
state = {
|
|
|
|
passwordEditEnabled: false,
|
2018-10-30 05:02:23 +00:00
|
|
|
phoneNumber: undefined
|
2018-02-13 19:46:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes new {@code InfoDialog} instance.
|
|
|
|
*
|
|
|
|
* @param {Object} props - The read-only properties with which the new
|
|
|
|
* instance is to be initialized.
|
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
constructor(props: Props) {
|
2018-02-13 19:46:47 +00:00
|
|
|
super(props);
|
|
|
|
|
2019-02-26 13:32:46 +00:00
|
|
|
if (props.dialIn && props.dialIn.numbers) {
|
2018-02-13 19:46:47 +00:00
|
|
|
this.state.phoneNumber
|
2019-02-26 13:32:46 +00:00
|
|
|
= _getDefaultPhoneNumber(props.dialIn.numbers);
|
2018-02-13 19:46:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The internal reference to the DOM/HTML element backing the React
|
|
|
|
* {@code Component} text area. It is necessary for the implementation
|
|
|
|
* of copying to the clipboard.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @type {HTMLTextAreaElement}
|
|
|
|
*/
|
|
|
|
this._copyElement = null;
|
|
|
|
|
|
|
|
// Bind event handlers so they are only bound once for every instance.
|
2018-04-20 17:28:16 +00:00
|
|
|
this._onClickURLText = this._onClickURLText.bind(this);
|
2018-02-13 19:46:47 +00:00
|
|
|
this._onCopyInviteURL = this._onCopyInviteURL.bind(this);
|
|
|
|
this._onPasswordRemove = this._onPasswordRemove.bind(this);
|
|
|
|
this._onPasswordSubmit = this._onPasswordSubmit.bind(this);
|
|
|
|
this._onTogglePasswordEditState
|
|
|
|
= this._onTogglePasswordEditState.bind(this);
|
|
|
|
this._setCopyElement = this._setCopyElement.bind(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
2019-03-05 14:26:45 +00:00
|
|
|
const {
|
|
|
|
isInlineDialog,
|
|
|
|
liveStreamViewURL,
|
|
|
|
onMouseOver,
|
|
|
|
t
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
const inlineDialog = (
|
2018-02-13 19:46:47 +00:00
|
|
|
<div
|
|
|
|
className = 'info-dialog'
|
|
|
|
onMouseOver = { onMouseOver } >
|
|
|
|
<div className = 'info-dialog-column'>
|
|
|
|
<h4 className = 'info-dialog-icon'>
|
2019-08-30 16:39:06 +00:00
|
|
|
<Icon src = { IconInfo } />
|
2018-02-13 19:46:47 +00:00
|
|
|
</h4>
|
|
|
|
</div>
|
|
|
|
<div className = 'info-dialog-column'>
|
|
|
|
<div className = 'info-dialog-title'>
|
|
|
|
{ t('info.title') }
|
|
|
|
</div>
|
|
|
|
<div className = 'info-dialog-conference-url'>
|
2018-04-04 15:58:54 +00:00
|
|
|
<span className = 'info-label'>
|
|
|
|
{ t('info.conferenceURL') }
|
|
|
|
</span>
|
|
|
|
<span className = 'spacer'> </span>
|
|
|
|
<span className = 'info-value'>
|
2018-04-08 16:21:52 +00:00
|
|
|
<a
|
2018-04-20 17:28:16 +00:00
|
|
|
className = 'info-dialog-url-text'
|
2018-04-08 16:21:52 +00:00
|
|
|
href = { this.props._inviteURL }
|
2018-04-20 17:28:16 +00:00
|
|
|
onClick = { this._onClickURLText } >
|
2019-07-10 17:27:11 +00:00
|
|
|
{ decodeURI(this._getURLToDisplay()) }
|
2018-04-08 16:21:52 +00:00
|
|
|
</a>
|
2018-04-04 15:58:54 +00:00
|
|
|
</span>
|
2018-02-13 19:46:47 +00:00
|
|
|
</div>
|
|
|
|
<div className = 'info-dialog-dial-in'>
|
|
|
|
{ this._renderDialInDisplay() }
|
|
|
|
</div>
|
2018-04-20 17:28:16 +00:00
|
|
|
{ liveStreamViewURL && this._renderLiveStreamURL() }
|
2018-02-13 19:46:47 +00:00
|
|
|
<div className = 'info-dialog-password'>
|
|
|
|
<PasswordForm
|
|
|
|
editEnabled = { this.state.passwordEditEnabled }
|
|
|
|
locked = { this.props._locked }
|
|
|
|
onSubmit = { this._onPasswordSubmit }
|
2019-05-22 07:43:17 +00:00
|
|
|
password = { this.props._password }
|
|
|
|
passwordNumberOfDigits = { this.props._passwordNumberOfDigits } />
|
2018-02-13 19:46:47 +00:00
|
|
|
</div>
|
|
|
|
<div className = 'info-dialog-action-links'>
|
|
|
|
<div className = 'info-dialog-action-link'>
|
|
|
|
<a
|
|
|
|
className = 'info-copy'
|
|
|
|
onClick = { this._onCopyInviteURL }>
|
|
|
|
{ t('dialog.copy') }
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
{ this._renderPasswordAction() }
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-04-04 15:58:54 +00:00
|
|
|
<textarea
|
|
|
|
className = 'info-dialog-copy-element'
|
|
|
|
readOnly = { true }
|
|
|
|
ref = { this._setCopyElement }
|
|
|
|
tabIndex = '-1'
|
|
|
|
value = { this._getTextToCopy() } />
|
2018-02-13 19:46:47 +00:00
|
|
|
</div>
|
|
|
|
);
|
2019-03-05 14:26:45 +00:00
|
|
|
|
|
|
|
if (isInlineDialog) {
|
|
|
|
return inlineDialog;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Dialog
|
|
|
|
cancelTitleKey = 'dialog.close'
|
|
|
|
submitDisabled = { true }
|
|
|
|
titleKey = 'info.label'
|
|
|
|
width = 'small'>
|
|
|
|
{ inlineDialog }
|
|
|
|
</Dialog>
|
|
|
|
);
|
2018-02-13 19:46:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a message describing how to dial in to the conference.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
|
|
|
_getTextToCopy() {
|
2019-05-09 08:37:21 +00:00
|
|
|
const { _localParticipant, liveStreamViewURL, t } = this.props;
|
2019-04-29 13:43:02 +00:00
|
|
|
const shouldDisplayDialIn = this._shouldDisplayDialIn();
|
2019-07-10 17:27:11 +00:00
|
|
|
const _inviteURL = _decodeRoomURI(this.props._inviteURL);
|
2018-02-13 19:46:47 +00:00
|
|
|
|
2019-05-09 08:37:21 +00:00
|
|
|
let invite = _localParticipant && _localParticipant.name
|
|
|
|
? t('info.inviteURLFirstPartPersonal', { name: _localParticipant.name })
|
|
|
|
: t('info.inviteURLFirstPartGeneral');
|
|
|
|
|
|
|
|
invite += t('info.inviteURLSecondPart', {
|
2019-07-10 17:27:11 +00:00
|
|
|
url: _inviteURL
|
2018-02-13 19:46:47 +00:00
|
|
|
});
|
|
|
|
|
2018-04-20 17:28:16 +00:00
|
|
|
if (liveStreamViewURL) {
|
|
|
|
const liveStream = t('info.inviteLiveStream', {
|
|
|
|
url: liveStreamViewURL
|
|
|
|
});
|
|
|
|
|
|
|
|
invite = `${invite}\n${liveStream}`;
|
|
|
|
}
|
|
|
|
|
2019-04-29 13:43:02 +00:00
|
|
|
if (shouldDisplayDialIn) {
|
2018-02-13 19:46:47 +00:00
|
|
|
const dial = t('info.invitePhone', {
|
|
|
|
number: this.state.phoneNumber,
|
2018-04-20 17:28:16 +00:00
|
|
|
conferenceID: this.props.dialIn.conferenceID
|
2018-02-13 19:46:47 +00:00
|
|
|
});
|
|
|
|
const moreNumbers = t('info.invitePhoneAlternatives', {
|
2019-07-10 17:27:11 +00:00
|
|
|
url: getDialInfoPageURL(
|
|
|
|
this.props._conferenceName,
|
|
|
|
this.props._locationURL
|
|
|
|
),
|
|
|
|
silentUrl: `${_inviteURL}#config.startSilent=true`
|
2018-02-13 19:46:47 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
invite = `${invite}\n${dial}\n${moreNumbers}`;
|
|
|
|
}
|
|
|
|
|
|
|
|
return invite;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Modifies the inviteURL for display in the modal.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
|
|
|
_getURLToDisplay() {
|
|
|
|
return this.props._inviteURL.replace(/^https?:\/\//i, '');
|
|
|
|
}
|
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
_onClickURLText: (Object) => void;
|
|
|
|
|
2018-04-08 16:21:52 +00:00
|
|
|
/**
|
2018-04-20 17:28:16 +00:00
|
|
|
* Callback invoked when a displayed URL link is clicked to prevent actual
|
2018-04-26 17:10:24 +00:00
|
|
|
* navigation from happening. The URL links have an href to display the
|
|
|
|
* action "Copy Link Address" in the context menu but otherwise it should
|
|
|
|
* not behave like links.
|
2018-04-08 16:21:52 +00:00
|
|
|
*
|
|
|
|
* @param {Object} event - The click event from clicking on the link.
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2018-04-20 17:28:16 +00:00
|
|
|
_onClickURLText(event) {
|
2018-04-08 16:21:52 +00:00
|
|
|
event.preventDefault();
|
|
|
|
}
|
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
_onCopyInviteURL: () => void;
|
|
|
|
|
2018-02-13 19:46:47 +00:00
|
|
|
/**
|
|
|
|
* Callback invoked to copy the contents of {@code this._copyElement} to the
|
|
|
|
* clipboard.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onCopyInviteURL() {
|
|
|
|
try {
|
2018-10-30 05:02:23 +00:00
|
|
|
if (!this._copyElement) {
|
|
|
|
throw new Error('No element to copy from.');
|
|
|
|
}
|
|
|
|
|
|
|
|
this._copyElement && this._copyElement.select();
|
2018-02-13 19:46:47 +00:00
|
|
|
document.execCommand('copy');
|
2018-10-30 05:02:23 +00:00
|
|
|
this._copyElement && this._copyElement.blur();
|
2018-02-13 19:46:47 +00:00
|
|
|
} catch (err) {
|
|
|
|
logger.error('error when copying the text', err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
_onPasswordRemove: () => void;
|
|
|
|
|
2018-02-13 19:46:47 +00:00
|
|
|
/**
|
|
|
|
* Callback invoked to unlock the current JitsiConference.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onPasswordRemove() {
|
|
|
|
this._onPasswordSubmit('');
|
|
|
|
}
|
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
_onPasswordSubmit: (string) => void;
|
|
|
|
|
2018-02-13 19:46:47 +00:00
|
|
|
/**
|
|
|
|
* Callback invoked to set a password on the current JitsiConference.
|
|
|
|
*
|
|
|
|
* @param {string} enteredPassword - The new password to be used to lock the
|
|
|
|
* current JitsiConference.
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onPasswordSubmit(enteredPassword) {
|
|
|
|
const { _conference } = this.props;
|
|
|
|
|
|
|
|
this.props.dispatch(setPassword(
|
|
|
|
_conference,
|
|
|
|
_conference.lock,
|
|
|
|
enteredPassword
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
_onTogglePasswordEditState: () => void;
|
|
|
|
|
2018-02-13 19:46:47 +00:00
|
|
|
/**
|
|
|
|
* Toggles whether or not the password should currently be shown as being
|
|
|
|
* edited locally.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onTogglePasswordEditState() {
|
|
|
|
this.setState({
|
|
|
|
passwordEditEnabled: !this.state.passwordEditEnabled
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a ReactElement for showing how to dial into the conference, if
|
|
|
|
* dialing in is available.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {null|ReactElement}
|
|
|
|
*/
|
|
|
|
_renderDialInDisplay() {
|
|
|
|
if (!this._shouldDisplayDialIn()) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<DialInNumber
|
2018-04-20 17:28:16 +00:00
|
|
|
conferenceID = { this.props.dialIn.conferenceID }
|
2018-02-13 19:46:47 +00:00
|
|
|
phoneNumber = { this.state.phoneNumber } />
|
|
|
|
<a
|
|
|
|
className = 'more-numbers'
|
2019-07-10 17:27:11 +00:00
|
|
|
href = {
|
|
|
|
getDialInfoPageURL(
|
|
|
|
this.props._conferenceName,
|
|
|
|
this.props._locationURL
|
|
|
|
)
|
|
|
|
}
|
2018-02-13 19:46:47 +00:00
|
|
|
rel = 'noopener noreferrer'
|
|
|
|
target = '_blank'>
|
|
|
|
{ this.props.t('info.moreNumbers') }
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a ReactElement for interacting with the password field.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {null|ReactElement}
|
|
|
|
*/
|
|
|
|
_renderPasswordAction() {
|
|
|
|
const { t } = this.props;
|
|
|
|
let className, onClick, textKey;
|
|
|
|
|
|
|
|
|
|
|
|
if (!this.props._canEditPassword) {
|
|
|
|
// intentionally left blank to prevent rendering anything
|
|
|
|
} else if (this.state.passwordEditEnabled) {
|
|
|
|
className = 'cancel-password';
|
|
|
|
onClick = this._onTogglePasswordEditState;
|
|
|
|
textKey = 'info.cancelPassword';
|
|
|
|
} else if (this.props._locked) {
|
|
|
|
className = 'remove-password';
|
|
|
|
onClick = this._onPasswordRemove;
|
|
|
|
textKey = 'dialog.removePassword';
|
|
|
|
} else {
|
|
|
|
className = 'add-password';
|
|
|
|
onClick = this._onTogglePasswordEditState;
|
2018-02-17 19:53:39 +00:00
|
|
|
textKey = 'info.addPassword';
|
2018-02-13 19:46:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return className && onClick && textKey
|
|
|
|
? <div className = 'info-dialog-action-link'>
|
|
|
|
<a
|
|
|
|
className = { className }
|
|
|
|
onClick = { onClick }>
|
|
|
|
{ t(textKey) }
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
: null;
|
|
|
|
}
|
|
|
|
|
2018-04-20 17:28:16 +00:00
|
|
|
/**
|
|
|
|
* Returns a ReactElement for display a link to the current url of a
|
|
|
|
* live stream in progress.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {null|ReactElement}
|
|
|
|
*/
|
|
|
|
_renderLiveStreamURL() {
|
|
|
|
const { liveStreamViewURL, t } = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className = 'info-dialog-live-stream-url'>
|
|
|
|
<span className = 'info-label'>
|
|
|
|
{ t('info.liveStreamURL') }
|
|
|
|
</span>
|
|
|
|
<span className = 'spacer'> </span>
|
|
|
|
<span className = 'info-value'>
|
|
|
|
<a
|
|
|
|
className = 'info-dialog-url-text'
|
|
|
|
href = { liveStreamViewURL }
|
|
|
|
onClick = { this._onClickURLText } >
|
|
|
|
{ liveStreamViewURL }
|
|
|
|
</a>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-02-13 19:46:47 +00:00
|
|
|
/**
|
|
|
|
* Returns whether or not dial-in related UI should be displayed.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
_shouldDisplayDialIn() {
|
2018-04-20 17:28:16 +00:00
|
|
|
const { conferenceID, numbers, numbersEnabled } = this.props.dialIn;
|
2018-02-13 19:46:47 +00:00
|
|
|
const { phoneNumber } = this.state;
|
|
|
|
|
|
|
|
return Boolean(
|
|
|
|
conferenceID
|
|
|
|
&& numbers
|
|
|
|
&& numbersEnabled
|
|
|
|
&& phoneNumber);
|
|
|
|
}
|
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
_setCopyElement: () => void;
|
|
|
|
|
2018-02-13 19:46:47 +00:00
|
|
|
/**
|
|
|
|
* Sets the internal reference to the DOM/HTML element backing the React
|
|
|
|
* {@code Component} input.
|
|
|
|
*
|
|
|
|
* @param {HTMLInputElement} element - The DOM/HTML element for this
|
|
|
|
* {@code Component}'s input.
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
_setCopyElement(element: Object) {
|
2018-02-13 19:46:47 +00:00
|
|
|
this._copyElement = element;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps (parts of) the Redux state to the associated props for the
|
|
|
|
* {@code InfoDialog} component.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
|
|
|
* @private
|
|
|
|
* @returns {{
|
|
|
|
* _canEditPassword: boolean,
|
|
|
|
* _conference: Object,
|
|
|
|
* _conferenceName: string,
|
|
|
|
* _inviteURL: string,
|
2018-09-07 22:48:58 +00:00
|
|
|
* _locationURL: string,
|
2018-02-13 19:46:47 +00:00
|
|
|
* _locked: string,
|
|
|
|
* _password: string
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
function _mapStateToProps(state) {
|
|
|
|
const {
|
|
|
|
conference,
|
|
|
|
locked,
|
|
|
|
password,
|
|
|
|
room
|
|
|
|
} = state['features/base/conference'];
|
|
|
|
|
|
|
|
return {
|
2019-05-09 11:30:38 +00:00
|
|
|
_canEditPassword: isLocalParticipantModerator(state, state['features/base/config'].lockRoomGuestEnabled),
|
2018-02-13 19:46:47 +00:00
|
|
|
_conference: conference,
|
|
|
|
_conferenceName: room,
|
2019-05-22 07:43:17 +00:00
|
|
|
_passwordNumberOfDigits: state['features/base/config'].roomPasswordNumberOfDigits,
|
2018-02-13 19:46:47 +00:00
|
|
|
_inviteURL: getInviteURL(state),
|
2019-05-09 08:37:21 +00:00
|
|
|
_localParticipant: getLocalParticipant(state),
|
2018-09-07 22:48:58 +00:00
|
|
|
_locationURL: state['features/base/connection'].locationURL,
|
2018-02-13 19:46:47 +00:00
|
|
|
_locked: locked,
|
|
|
|
_password: password
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default translate(connect(_mapStateToProps)(InfoDialog));
|