2021-04-09 12:30:25 +00:00
|
|
|
import React, { PureComponent } from 'react';
|
|
|
|
import {
|
|
|
|
Text,
|
|
|
|
View
|
|
|
|
} from 'react-native';
|
|
|
|
import type { Dispatch } from 'redux';
|
|
|
|
|
2022-09-27 07:10:28 +00:00
|
|
|
import { MEETING_PASSWORD_ENABLED, getFeatureFlag } from '../../../../base/flags';
|
2021-04-09 12:30:25 +00:00
|
|
|
import { translate } from '../../../../base/i18n';
|
2021-12-10 16:23:27 +00:00
|
|
|
import JitsiScreen from '../../../../base/modal/components/JitsiScreen';
|
2021-04-09 12:30:25 +00:00
|
|
|
import { isLocalParticipantModerator } from '../../../../base/participants';
|
2021-12-10 16:23:27 +00:00
|
|
|
import { connect } from '../../../../base/redux';
|
2022-07-27 08:40:34 +00:00
|
|
|
import Button from '../../../../base/ui/components/native/Button';
|
2022-08-17 10:43:38 +00:00
|
|
|
import Input from '../../../../base/ui/components/native/Input';
|
2022-08-25 11:25:13 +00:00
|
|
|
import Switch from '../../../../base/ui/components/native/Switch';
|
2022-11-09 12:45:55 +00:00
|
|
|
import { BUTTON_TYPES } from '../../../../base/ui/constants.native';
|
2022-10-06 08:11:06 +00:00
|
|
|
import { copyText } from '../../../../base/util/copyText.native';
|
2021-11-30 13:41:23 +00:00
|
|
|
import { isInBreakoutRoom } from '../../../../breakout-rooms/functions';
|
2021-04-09 12:30:25 +00:00
|
|
|
import { toggleLobbyMode } from '../../../../lobby/actions.any';
|
2021-12-10 16:23:27 +00:00
|
|
|
import { LOCKED_LOCALLY, LOCKED_REMOTELY } from '../../../../room-lock';
|
2021-04-09 12:30:25 +00:00
|
|
|
import {
|
|
|
|
endRoomLockRequest,
|
|
|
|
unlockRoom
|
|
|
|
} from '../../../../room-lock/actions';
|
2021-12-10 16:23:27 +00:00
|
|
|
|
|
|
|
import styles from './styles';
|
2021-04-09 12:30:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The style of the {@link TextInput} rendered by {@code SecurityDialog}. As it
|
|
|
|
* requests the entry of a password, {@code TextInput} automatically correcting
|
|
|
|
* the entry of the password is a pain to deal with as a user.
|
|
|
|
*/
|
|
|
|
const _TEXT_INPUT_PROPS = {
|
|
|
|
autoCapitalize: 'none',
|
|
|
|
autoCorrect: false
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} props of {@link SecurityDialog}.
|
|
|
|
*/
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The JitsiConference which requires a password.
|
|
|
|
*/
|
|
|
|
_conference: Object,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether the local user is the moderator.
|
|
|
|
*/
|
|
|
|
_isModerator: boolean,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* State of the lobby mode.
|
|
|
|
*/
|
|
|
|
_lobbyEnabled: boolean,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether the lobby mode switch is available or not.
|
|
|
|
*/
|
|
|
|
_lobbyModeSwitchVisible: boolean,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The value for how the conference is locked (or undefined if not locked)
|
|
|
|
* as defined by room-lock constants.
|
|
|
|
*/
|
|
|
|
_locked: string,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if the conference room is locked or not.
|
|
|
|
*/
|
|
|
|
_lockedConference: boolean,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The current known password for the JitsiConference.
|
|
|
|
*/
|
|
|
|
_password: string,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Number of digits used in the room-lock password.
|
|
|
|
*/
|
|
|
|
_passwordNumberOfDigits: number,
|
|
|
|
|
|
|
|
/**
|
2021-12-10 16:23:27 +00:00
|
|
|
* Whether setting a room password is available or not.
|
2021-04-09 12:30:25 +00:00
|
|
|
*/
|
2021-12-10 16:23:27 +00:00
|
|
|
_roomPasswordControls: boolean,
|
2021-04-09 12:30:25 +00:00
|
|
|
|
|
|
|
/**
|
2021-12-10 16:23:27 +00:00
|
|
|
* Redux store dispatch function.
|
2021-04-09 12:30:25 +00:00
|
|
|
*/
|
2021-12-10 16:23:27 +00:00
|
|
|
dispatch: Dispatch<any>,
|
2021-04-09 12:30:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoked to obtain translated strings.
|
|
|
|
*/
|
|
|
|
t: Function
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} state of {@link SecurityDialog}.
|
|
|
|
*/
|
|
|
|
type State = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Password added by the participant for room lock.
|
|
|
|
*/
|
|
|
|
passwordInputValue: string,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shows an input or a message.
|
|
|
|
*/
|
|
|
|
showElement: boolean
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Component that renders the security options dialog.
|
|
|
|
*
|
|
|
|
* @returns {React$Element<any>}
|
|
|
|
*/
|
|
|
|
class SecurityDialog extends PureComponent<Props, State> {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Instantiates a new {@code SecurityDialog}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
constructor(props: Props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
passwordInputValue: '',
|
|
|
|
showElement: props._locked === LOCKED_LOCALLY || false
|
|
|
|
};
|
|
|
|
|
|
|
|
this._onChangeText = this._onChangeText.bind(this);
|
2021-12-10 16:23:27 +00:00
|
|
|
this._onCancel = this._onCancel.bind(this);
|
|
|
|
this._onCopy = this._onCopy.bind(this);
|
2021-04-09 12:30:25 +00:00
|
|
|
this._onSubmit = this._onSubmit.bind(this);
|
|
|
|
this._onToggleLobbyMode = this._onToggleLobbyMode.bind(this);
|
2021-12-10 16:23:27 +00:00
|
|
|
this._onAddPassword = this._onAddPassword.bind(this);
|
|
|
|
}
|
|
|
|
|
2021-04-09 12:30:25 +00:00
|
|
|
/**
|
|
|
|
* Implements {@code SecurityDialog.render}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
render() {
|
|
|
|
return (
|
2021-12-10 16:23:27 +00:00
|
|
|
<JitsiScreen style = { styles.securityDialogContainer }>
|
|
|
|
{ this._renderLobbyMode() }
|
|
|
|
{ this._renderSetRoomPassword() }
|
|
|
|
</JitsiScreen>
|
2021-04-09 12:30:25 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders lobby mode.
|
|
|
|
*
|
|
|
|
* @returns {ReactElement}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
_renderLobbyMode() {
|
|
|
|
const {
|
|
|
|
_lobbyEnabled,
|
|
|
|
_lobbyModeSwitchVisible,
|
|
|
|
t
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
if (!_lobbyModeSwitchVisible) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2021-12-10 16:23:27 +00:00
|
|
|
<View style = { styles.lobbyModeContainer }>
|
|
|
|
<View style = { styles.lobbyModeContent } >
|
2022-02-17 14:51:00 +00:00
|
|
|
<Text style = { styles.lobbyModeText }>
|
2021-12-10 16:23:27 +00:00
|
|
|
{ t('lobby.enableDialogText') }
|
|
|
|
</Text>
|
|
|
|
<View style = { styles.lobbyModeSection }>
|
|
|
|
<Text style = { styles.lobbyModeLabel } >
|
|
|
|
{ t('lobby.toggleLabel') }
|
|
|
|
</Text>
|
2022-08-25 11:25:13 +00:00
|
|
|
<Switch
|
|
|
|
checked = { _lobbyEnabled }
|
|
|
|
onChange = { this._onToggleLobbyMode } />
|
2021-12-10 16:23:27 +00:00
|
|
|
</View>
|
|
|
|
</View>
|
2021-04-09 12:30:25 +00:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-12-10 16:23:27 +00:00
|
|
|
* Renders setting the password.
|
2021-04-09 12:30:25 +00:00
|
|
|
*
|
|
|
|
* @returns {ReactElement}
|
|
|
|
* @private
|
|
|
|
*/
|
2021-12-10 16:23:27 +00:00
|
|
|
_renderSetRoomPassword() {
|
2021-04-09 12:30:25 +00:00
|
|
|
const {
|
|
|
|
_isModerator,
|
|
|
|
_locked,
|
|
|
|
_lockedConference,
|
2021-12-10 16:23:27 +00:00
|
|
|
_password,
|
|
|
|
_roomPasswordControls,
|
2021-04-09 12:30:25 +00:00
|
|
|
t
|
|
|
|
} = this.props;
|
|
|
|
const { showElement } = this.state;
|
2021-12-10 16:23:27 +00:00
|
|
|
let setPasswordControls;
|
2021-04-09 12:30:25 +00:00
|
|
|
|
2021-12-10 16:23:27 +00:00
|
|
|
if (!_roomPasswordControls) {
|
2021-04-09 12:30:25 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2021-12-10 16:23:27 +00:00
|
|
|
if (_locked && showElement) {
|
|
|
|
setPasswordControls = (
|
|
|
|
<>
|
2022-07-08 16:02:22 +00:00
|
|
|
<Button
|
|
|
|
accessibilityLabel = 'dialog.Remove'
|
2022-08-22 09:40:59 +00:00
|
|
|
labelKey = 'dialog.Remove'
|
2022-07-08 16:02:22 +00:00
|
|
|
labelStyle = { styles.passwordSetupButtonLabel }
|
2022-08-22 09:40:59 +00:00
|
|
|
onClick = { this._onCancel }
|
2022-07-08 16:02:22 +00:00
|
|
|
type = { BUTTON_TYPES.TERTIARY } />
|
2021-12-10 16:23:27 +00:00
|
|
|
{
|
|
|
|
_password
|
2022-07-08 16:02:22 +00:00
|
|
|
&& <Button
|
|
|
|
accessibilityLabel = 'dialog.copy'
|
2022-08-22 09:40:59 +00:00
|
|
|
labelKey = 'dialog.copy'
|
2022-07-08 16:02:22 +00:00
|
|
|
labelStyle = { styles.passwordSetupButtonLabel }
|
2022-08-22 09:40:59 +00:00
|
|
|
onClick = { this._onCopy }
|
2022-07-08 16:02:22 +00:00
|
|
|
type = { BUTTON_TYPES.TERTIARY } />
|
2021-12-10 16:23:27 +00:00
|
|
|
}
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
} else if (!_lockedConference && showElement) {
|
|
|
|
setPasswordControls = (
|
|
|
|
<>
|
2022-07-08 16:02:22 +00:00
|
|
|
<Button
|
|
|
|
accessibilityLabel = 'dialog.Cancel'
|
2022-08-22 09:40:59 +00:00
|
|
|
labelKey = 'dialog.Cancel'
|
2022-07-08 16:02:22 +00:00
|
|
|
labelStyle = { styles.passwordSetupButtonLabel }
|
2022-08-22 09:40:59 +00:00
|
|
|
onClick = { this._onCancel }
|
2022-07-08 16:02:22 +00:00
|
|
|
type = { BUTTON_TYPES.TERTIARY } />
|
|
|
|
<Button
|
|
|
|
accessibilityLabel = 'dialog.add'
|
2022-08-22 09:40:59 +00:00
|
|
|
labelKey = 'dialog.add'
|
2022-07-08 16:02:22 +00:00
|
|
|
labelStyle = { styles.passwordSetupButtonLabel }
|
2022-08-22 09:40:59 +00:00
|
|
|
onClick = { this._onSubmit }
|
2022-07-08 16:02:22 +00:00
|
|
|
type = { BUTTON_TYPES.TERTIARY } />
|
2021-12-10 16:23:27 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
} else if (!_lockedConference && !showElement) {
|
|
|
|
setPasswordControls = (
|
2022-07-08 16:02:22 +00:00
|
|
|
<Button
|
|
|
|
accessibilityLabel = 'info.addPassword'
|
2021-12-10 16:23:27 +00:00
|
|
|
disabled = { !_isModerator }
|
2022-08-22 09:40:59 +00:00
|
|
|
labelKey = 'info.addPassword'
|
2022-07-08 16:02:22 +00:00
|
|
|
labelStyle = { styles.passwordSetupButtonLabel }
|
2022-08-22 09:40:59 +00:00
|
|
|
onClick = { this._onAddPassword }
|
2022-07-08 16:02:22 +00:00
|
|
|
type = { BUTTON_TYPES.TERTIARY } />
|
2021-12-10 16:23:27 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_locked === LOCKED_REMOTELY) {
|
|
|
|
if (_isModerator) {
|
|
|
|
setPasswordControls = (
|
|
|
|
<View style = { styles.passwordSetRemotelyContainer }>
|
|
|
|
<Text style = { styles.passwordSetRemotelyText }>
|
|
|
|
{ t('passwordSetRemotely') }
|
|
|
|
</Text>
|
2022-07-08 16:02:22 +00:00
|
|
|
<Button
|
|
|
|
accessibilityLabel = 'dialog.Remove'
|
2022-08-22 09:40:59 +00:00
|
|
|
labelKey = 'dialog.Remove'
|
2022-07-08 16:02:22 +00:00
|
|
|
labelStyle = { styles.passwordSetupButtonLabel }
|
2022-08-22 09:40:59 +00:00
|
|
|
onClick = { this._onCancel }
|
2022-07-08 16:02:22 +00:00
|
|
|
type = { BUTTON_TYPES.TERTIARY } />
|
2021-12-10 16:23:27 +00:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
setPasswordControls = (
|
|
|
|
<View style = { styles.passwordSetRemotelyContainer }>
|
|
|
|
<Text style = { styles.passwordSetRemotelyTextDisabled }>
|
|
|
|
{ t('passwordSetRemotely') }
|
|
|
|
</Text>
|
2022-07-08 16:02:22 +00:00
|
|
|
<Button
|
|
|
|
accessibilityLabel = 'info.addPassword'
|
2021-12-10 16:23:27 +00:00
|
|
|
disabled = { !_isModerator }
|
2022-08-22 09:40:59 +00:00
|
|
|
labelKey = 'info.addPassword'
|
2022-07-08 16:02:22 +00:00
|
|
|
labelStyle = { styles.passwordSetupButtonLabel }
|
2022-08-22 09:40:59 +00:00
|
|
|
onClick = { this._onAddPassword }
|
2022-07-08 16:02:22 +00:00
|
|
|
type = { BUTTON_TYPES.TERTIARY } />
|
2021-12-10 16:23:27 +00:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-09 12:30:25 +00:00
|
|
|
return (
|
2021-12-10 16:23:27 +00:00
|
|
|
<View
|
|
|
|
style = { styles.passwordContainer } >
|
2022-02-17 14:51:00 +00:00
|
|
|
<Text style = { styles.passwordContainerText }>
|
2022-08-29 11:40:35 +00:00
|
|
|
{ t(_isModerator ? 'security.about' : 'security.aboutReadOnly') }
|
2021-04-09 12:30:25 +00:00
|
|
|
</Text>
|
2021-12-10 16:23:27 +00:00
|
|
|
<View
|
|
|
|
style = {
|
|
|
|
_locked !== LOCKED_REMOTELY
|
|
|
|
&& styles.passwordContainerControls
|
|
|
|
}>
|
|
|
|
<View>
|
|
|
|
{ this._setRoomPasswordMessage() }
|
|
|
|
</View>
|
2022-08-29 11:40:35 +00:00
|
|
|
{ _isModerator && setPasswordControls }
|
2021-12-10 16:23:27 +00:00
|
|
|
</View>
|
2021-04-09 12:30:25 +00:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders room lock text input/message.
|
|
|
|
*
|
|
|
|
* @returns {ReactElement}
|
|
|
|
* @private
|
|
|
|
*/
|
2021-12-10 16:23:27 +00:00
|
|
|
_setRoomPasswordMessage() {
|
2021-04-09 12:30:25 +00:00
|
|
|
let textInputProps = _TEXT_INPUT_PROPS;
|
|
|
|
const {
|
|
|
|
_isModerator,
|
|
|
|
_locked,
|
|
|
|
_password,
|
|
|
|
_passwordNumberOfDigits,
|
|
|
|
t
|
|
|
|
} = this.props;
|
|
|
|
const { passwordInputValue, showElement } = this.state;
|
|
|
|
|
|
|
|
if (_passwordNumberOfDigits) {
|
|
|
|
textInputProps = {
|
|
|
|
...textInputProps,
|
|
|
|
keyboardType: 'numeric',
|
|
|
|
maxLength: _passwordNumberOfDigits
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_isModerator) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (showElement) {
|
|
|
|
if (typeof _locked === 'undefined') {
|
|
|
|
return (
|
2022-08-17 10:43:38 +00:00
|
|
|
<Input
|
|
|
|
accessibilityLabel = { t('info.addPassword') }
|
2021-12-10 16:23:27 +00:00
|
|
|
autoFocus = { true }
|
2022-08-17 10:43:38 +00:00
|
|
|
clearable = { true }
|
2022-11-08 15:46:46 +00:00
|
|
|
customStyles = {{ container: styles.customContainer }}
|
2022-08-17 10:43:38 +00:00
|
|
|
onChange = { this._onChangeText }
|
|
|
|
placeholder = { t('dialog.password') }
|
2021-04-09 12:30:25 +00:00
|
|
|
value = { passwordInputValue }
|
|
|
|
{ ...textInputProps } />
|
|
|
|
);
|
|
|
|
} else if (_locked) {
|
|
|
|
if (_locked === LOCKED_LOCALLY && typeof _password !== 'undefined') {
|
|
|
|
return (
|
2021-12-10 16:23:27 +00:00
|
|
|
<View style = { styles.savedPasswordContainer }>
|
|
|
|
<Text style = { styles.savedPasswordLabel }>
|
|
|
|
{ t('info.password') }
|
|
|
|
</Text>
|
|
|
|
<Text style = { styles.savedPassword }>
|
2022-08-29 11:40:35 +00:00
|
|
|
{ _password }
|
2021-12-10 16:23:27 +00:00
|
|
|
</Text>
|
|
|
|
</View>
|
2021-04-09 12:30:25 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_onToggleLobbyMode: () => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles the enable-disable lobby mode switch.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onToggleLobbyMode() {
|
|
|
|
const { _lobbyEnabled, dispatch } = this.props;
|
|
|
|
|
|
|
|
if (_lobbyEnabled) {
|
|
|
|
dispatch(toggleLobbyMode(false));
|
|
|
|
} else {
|
|
|
|
dispatch(toggleLobbyMode(true));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-10 16:23:27 +00:00
|
|
|
_onAddPassword: () => void;
|
2021-04-09 12:30:25 +00:00
|
|
|
|
|
|
|
/**
|
2021-12-10 16:23:27 +00:00
|
|
|
* Callback to be invoked when add password button is pressed.
|
2021-04-09 12:30:25 +00:00
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2021-12-10 16:23:27 +00:00
|
|
|
_onAddPassword() {
|
2021-04-09 12:30:25 +00:00
|
|
|
const { showElement } = this.state;
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
showElement: !showElement
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Verifies input in case only digits are required.
|
|
|
|
*
|
|
|
|
* @param {string} passwordInputValue - The value of the password
|
|
|
|
* text input.
|
|
|
|
* @private
|
|
|
|
* @returns {boolean} False when the value is not valid and True otherwise.
|
|
|
|
*/
|
|
|
|
_validateInputValue(passwordInputValue: string) {
|
|
|
|
const { _passwordNumberOfDigits } = this.props;
|
|
|
|
|
|
|
|
// we want only digits,
|
|
|
|
// but both number-pad and numeric add ',' and '.' as symbols
|
|
|
|
if (_passwordNumberOfDigits
|
|
|
|
&& passwordInputValue.length > 0
|
|
|
|
&& !/^\d+$/.test(passwordInputValue)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
_onChangeText: string => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback to be invoked when the text in the field changes.
|
|
|
|
*
|
|
|
|
* @param {string} passwordInputValue - The value of password input.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onChangeText(passwordInputValue) {
|
|
|
|
if (!this._validateInputValue(passwordInputValue)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
passwordInputValue
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-12-10 16:23:27 +00:00
|
|
|
_onCancel: () => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cancels value typed in text input.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onCancel() {
|
|
|
|
this.setState({
|
|
|
|
passwordInputValue: '',
|
|
|
|
showElement: false
|
|
|
|
});
|
|
|
|
|
|
|
|
this.props.dispatch(unlockRoom());
|
|
|
|
}
|
|
|
|
|
|
|
|
_onCopy: () => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Copies room password.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onCopy() {
|
|
|
|
const { passwordInputValue } = this.state;
|
|
|
|
|
2022-10-06 08:11:06 +00:00
|
|
|
copyText(passwordInputValue);
|
2021-12-10 16:23:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_onSubmit: () => void;
|
2021-04-09 12:30:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Submits value typed in text input.
|
|
|
|
*
|
2021-12-10 16:23:27 +00:00
|
|
|
* @returns {void}
|
2021-04-09 12:30:25 +00:00
|
|
|
*/
|
|
|
|
_onSubmit() {
|
|
|
|
const {
|
|
|
|
_conference,
|
|
|
|
dispatch
|
|
|
|
} = this.props;
|
|
|
|
const { passwordInputValue } = this.state;
|
|
|
|
|
|
|
|
dispatch(endRoomLockRequest(_conference, passwordInputValue));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps part of the Redux state to the props of this component.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
|
|
|
* @returns {Props}
|
|
|
|
*/
|
|
|
|
function _mapStateToProps(state: Object): Object {
|
|
|
|
const { conference, locked, password } = state['features/base/conference'];
|
|
|
|
const { hideLobbyButton } = state['features/base/config'];
|
|
|
|
const { lobbyEnabled } = state['features/lobby'];
|
|
|
|
const { roomPasswordNumberOfDigits } = state['features/base/config'];
|
|
|
|
const lobbySupported = conference && conference.isLobbySupported();
|
|
|
|
const visible = getFeatureFlag(state, MEETING_PASSWORD_ENABLED, true);
|
|
|
|
|
|
|
|
return {
|
|
|
|
_conference: conference,
|
|
|
|
_isModerator: isLocalParticipantModerator(state),
|
|
|
|
_lobbyEnabled: lobbyEnabled,
|
|
|
|
_lobbyModeSwitchVisible:
|
2021-11-30 13:41:23 +00:00
|
|
|
lobbySupported && isLocalParticipantModerator(state) && !hideLobbyButton && !isInBreakoutRoom(state),
|
2021-04-09 12:30:25 +00:00
|
|
|
_locked: locked,
|
|
|
|
_lockedConference: Boolean(conference && locked),
|
|
|
|
_password: password,
|
|
|
|
_passwordNumberOfDigits: roomPasswordNumberOfDigits,
|
2021-12-10 16:23:27 +00:00
|
|
|
_roomPasswordControls: visible
|
2021-04-09 12:30:25 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default translate(connect(_mapStateToProps)(SecurityDialog));
|