feat(prejoin_page): Add prejoin page

This commit is contained in:
Vlad Piersec
2020-04-16 13:47:10 +03:00
committed by Saúl Ibarra Corretgé
parent 5b53232964
commit a45cbf41ef
36 changed files with 2274 additions and 147 deletions

View File

@@ -1,11 +1,10 @@
// @flow
import React, { Component } from 'react';
import { isVideoSettingsButtonDisabled } from '../../functions';
import { toggleVideoSettings, VideoSettingsPopup } from '../../../settings';
import VideoMuteButton from '../VideoMuteButton';
import JitsiMeetJS from '../../../base/lib-jitsi-meet/_';
import { hasAvailableDevices } from '../../../base/devices';
import { IconArrowDown } from '../../../base/icons';
import { connect } from '../../../base/redux';
import { ToolboxButtonWithIcon } from '../../../base/toolbox';
@@ -25,9 +24,9 @@ type Props = {
permissionPromptVisibility: boolean,
/**
* If the user has any video devices.
* If the button should be disabled
*/
hasDevices: boolean,
isDisabled: boolean,
/**
* Flag controlling the visibility of the button.
@@ -49,6 +48,8 @@ type State = {
* @returns {ReactElement}
*/
class VideoSettingsButton extends Component<Props, State> {
_isMounted: boolean;
/**
* Initializes a new {@code VideoSettingsButton} instance.
*
@@ -58,6 +59,7 @@ class VideoSettingsButton extends Component<Props, State> {
constructor(props) {
super(props);
this._isMounted = true;
this.state = {
hasPermissions: false
};
@@ -73,7 +75,7 @@ class VideoSettingsButton extends Component<Props, State> {
'video',
);
this.setState({
this._isMounted && this.setState({
hasPermissions
});
}
@@ -98,14 +100,23 @@ class VideoSettingsButton extends Component<Props, State> {
}
}
/**
* Implements React's {@link Component#componentWillUnmount}.
*
* @inheritdoc
*/
componentWillUnmount() {
this._isMounted = false;
}
/**
* Implements React's {@link Component#render}.
*
* @inheritdoc
*/
render() {
const { hasDevices, onVideoOptionsClick, visible } = this.props;
const iconDisabled = !this.state.hasPermissions || !hasDevices;
const { isDisabled, onVideoOptionsClick, visible } = this.props;
const iconDisabled = !this.state.hasPermissions || isDisabled;
return visible ? (
<VideoSettingsPopup>
@@ -128,7 +139,7 @@ class VideoSettingsButton extends Component<Props, State> {
*/
function mapStateToProps(state) {
return {
hasDevices: hasAvailableDevices(state, 'videoInput'),
isDisabled: isVideoSettingsButtonDisabled(state),
permissionPromptVisibility: getMediaPermissionPromptVisibility(state)
};
}