2018-02-19 22:52:21 +00:00
|
|
|
// @flow
|
|
|
|
|
2017-02-16 23:02:40 +00:00
|
|
|
import React, { Component } from 'react';
|
2016-10-05 14:36:59 +00:00
|
|
|
import { View } from 'react-native';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
2017-12-11 18:48:32 +00:00
|
|
|
import {
|
2018-01-03 21:24:07 +00:00
|
|
|
AUDIO_MUTE,
|
|
|
|
VIDEO_MUTE,
|
|
|
|
createToolbarEvent,
|
|
|
|
sendAnalytics
|
2017-12-11 18:48:32 +00:00
|
|
|
} from '../../analytics';
|
2017-03-29 12:07:05 +00:00
|
|
|
import { toggleAudioOnly } from '../../base/conference';
|
2017-08-04 21:06:42 +00:00
|
|
|
import {
|
|
|
|
MEDIA_TYPE,
|
|
|
|
setAudioMuted,
|
|
|
|
setVideoMuted,
|
2017-08-14 13:27:24 +00:00
|
|
|
toggleCameraFacingMode,
|
|
|
|
VIDEO_MUTISM_AUTHORITY
|
2017-08-04 21:06:42 +00:00
|
|
|
} from '../../base/media';
|
2016-10-05 14:36:59 +00:00
|
|
|
import { Container } from '../../base/react';
|
2018-02-06 18:14:05 +00:00
|
|
|
import {
|
|
|
|
isNarrowAspectRatio,
|
|
|
|
makeAspectRatioAware
|
|
|
|
} from '../../base/responsive-ui';
|
2016-10-05 14:36:59 +00:00
|
|
|
import { ColorPalette } from '../../base/styles';
|
2018-02-19 22:52:21 +00:00
|
|
|
import {
|
|
|
|
EnterPictureInPictureToolbarButton
|
|
|
|
} from '../../mobile/picture-in-picture';
|
2017-02-16 23:02:40 +00:00
|
|
|
import { beginRoomLockRequest } from '../../room-lock';
|
2017-01-31 09:52:29 +00:00
|
|
|
import { beginShareRoom } from '../../share-room';
|
2016-10-05 14:36:59 +00:00
|
|
|
|
2017-02-16 23:02:40 +00:00
|
|
|
import {
|
|
|
|
abstractMapDispatchToProps,
|
|
|
|
abstractMapStateToProps
|
|
|
|
} from '../functions';
|
2017-10-24 08:40:39 +00:00
|
|
|
|
|
|
|
import AudioRouteButton from './AudioRouteButton';
|
2017-06-10 22:50:42 +00:00
|
|
|
import styles from './styles';
|
2016-10-05 14:36:59 +00:00
|
|
|
import ToolbarButton from './ToolbarButton';
|
|
|
|
|
2017-09-07 17:25:08 +00:00
|
|
|
/**
|
|
|
|
* The indicator which determines (at bundle time) whether there should be a
|
|
|
|
* {@code ToolbarButton} in {@code Toolbox} to expose the functionality of the
|
|
|
|
* feature share-room in the user interface of the app.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
|
|
|
const _SHARE_ROOM_TOOLBAR_BUTTON = true;
|
|
|
|
|
2016-10-05 14:36:59 +00:00
|
|
|
/**
|
2018-02-19 22:52:21 +00:00
|
|
|
* The type of {@link Toolbox}'s React {@code Component} props.
|
2016-10-05 14:36:59 +00:00
|
|
|
*/
|
2018-02-19 22:52:21 +00:00
|
|
|
type Props = {
|
|
|
|
|
2016-12-01 01:52:39 +00:00
|
|
|
/**
|
2018-02-19 22:52:21 +00:00
|
|
|
* Flag showing that audio is muted.
|
2016-12-01 01:52:39 +00:00
|
|
|
*/
|
2018-02-19 22:52:21 +00:00
|
|
|
_audioMuted: boolean,
|
2017-07-03 07:06:33 +00:00
|
|
|
|
2018-02-19 22:52:21 +00:00
|
|
|
/**
|
|
|
|
* Flag showing whether the audio-only mode is in use.
|
|
|
|
*/
|
|
|
|
_audioOnly: boolean,
|
2018-02-06 10:41:23 +00:00
|
|
|
|
2018-02-19 22:52:21 +00:00
|
|
|
/**
|
|
|
|
* The indicator which determines whether the toolbox is enabled.
|
|
|
|
*/
|
|
|
|
_enabled: boolean,
|
2016-10-05 14:36:59 +00:00
|
|
|
|
2018-02-19 22:52:21 +00:00
|
|
|
/**
|
|
|
|
* Flag showing whether room is locked.
|
|
|
|
*/
|
|
|
|
_locked: boolean,
|
2017-02-16 23:02:40 +00:00
|
|
|
|
2018-02-19 22:52:21 +00:00
|
|
|
/**
|
|
|
|
* Handler for hangup.
|
|
|
|
*/
|
|
|
|
_onHangup: Function,
|
2018-02-01 16:02:07 +00:00
|
|
|
|
2018-02-19 22:52:21 +00:00
|
|
|
/**
|
|
|
|
* Sets the lock i.e. password protection of the conference/room.
|
|
|
|
*/
|
|
|
|
_onRoomLock: Function,
|
2017-02-16 23:02:40 +00:00
|
|
|
|
2018-02-19 22:52:21 +00:00
|
|
|
/**
|
|
|
|
* Begins the UI procedure to share the conference/room URL.
|
|
|
|
*/
|
|
|
|
_onShareRoom: Function,
|
2017-01-31 09:52:29 +00:00
|
|
|
|
2018-02-19 22:52:21 +00:00
|
|
|
/**
|
|
|
|
* Toggles the audio-only flag of the conference.
|
|
|
|
*/
|
|
|
|
_onToggleAudioOnly: Function,
|
2017-03-29 12:07:05 +00:00
|
|
|
|
2018-02-19 22:52:21 +00:00
|
|
|
/**
|
|
|
|
* Switches between the front/user-facing and back/environment-facing
|
|
|
|
* cameras.
|
|
|
|
*/
|
|
|
|
_onToggleCameraFacingMode: Function,
|
2017-02-16 23:02:40 +00:00
|
|
|
|
2018-02-19 22:52:21 +00:00
|
|
|
/**
|
|
|
|
* Flag showing whether video is muted.
|
|
|
|
*/
|
|
|
|
_videoMuted: boolean,
|
2018-02-01 16:02:07 +00:00
|
|
|
|
2018-02-19 22:52:21 +00:00
|
|
|
/**
|
|
|
|
* Flag showing whether toolbar is visible.
|
|
|
|
*/
|
|
|
|
_visible: boolean,
|
2017-02-16 23:02:40 +00:00
|
|
|
|
2018-02-19 22:52:21 +00:00
|
|
|
dispatch: Function
|
|
|
|
};
|
2017-08-04 21:06:42 +00:00
|
|
|
|
2016-10-05 14:36:59 +00:00
|
|
|
|
2018-02-19 22:52:21 +00:00
|
|
|
/**
|
|
|
|
* Implements the conference toolbox on React Native.
|
|
|
|
*/
|
|
|
|
class Toolbox extends Component<Props> {
|
2017-08-04 21:06:42 +00:00
|
|
|
/**
|
|
|
|
* Initializes a new {@code Toolbox} instance.
|
|
|
|
*
|
2018-02-19 22:52:21 +00:00
|
|
|
* @param {Props} props - The read-only React {@code Component} props with
|
2017-08-04 21:06:42 +00:00
|
|
|
* which the new instance is to be initialized.
|
|
|
|
*/
|
2018-02-19 22:52:21 +00:00
|
|
|
constructor(props: Props) {
|
2017-08-04 21:06:42 +00:00
|
|
|
super(props);
|
|
|
|
|
|
|
|
// Bind event handlers so they are only bound once per instance.
|
|
|
|
this._onToggleAudio = this._onToggleAudio.bind(this);
|
|
|
|
this._onToggleVideo = this._onToggleVideo.bind(this);
|
|
|
|
}
|
|
|
|
|
2016-10-05 14:36:59 +00:00
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
2018-02-06 10:41:23 +00:00
|
|
|
if (!this.props._enabled) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2017-11-07 14:28:08 +00:00
|
|
|
const toolboxStyle
|
|
|
|
= isNarrowAspectRatio(this)
|
|
|
|
? styles.toolboxNarrow
|
|
|
|
: styles.toolboxWide;
|
|
|
|
|
2016-12-11 23:39:31 +00:00
|
|
|
return (
|
|
|
|
<Container
|
2017-11-07 14:28:08 +00:00
|
|
|
style = { toolboxStyle }
|
2017-10-19 18:19:32 +00:00
|
|
|
visible = { this.props._visible } >
|
2017-10-19 18:29:34 +00:00
|
|
|
{ this._renderToolbars() }
|
2016-12-11 23:39:31 +00:00
|
|
|
</Container>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-02-16 23:02:40 +00:00
|
|
|
/**
|
|
|
|
* Gets the styles for a button that toggles the mute state of a specific
|
|
|
|
* media type.
|
|
|
|
*
|
|
|
|
* @param {string} mediaType - The {@link MEDIA_TYPE} associated with the
|
|
|
|
* button to get styles for.
|
|
|
|
* @protected
|
|
|
|
* @returns {{
|
|
|
|
* iconName: string,
|
|
|
|
* iconStyle: Object,
|
|
|
|
* style: Object
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
_getMuteButtonStyles(mediaType) {
|
|
|
|
let iconName;
|
|
|
|
let iconStyle;
|
2017-04-11 17:00:41 +00:00
|
|
|
let style;
|
2017-02-16 23:02:40 +00:00
|
|
|
|
|
|
|
if (this.props[`_${mediaType}Muted`]) {
|
2018-02-19 22:52:21 +00:00
|
|
|
iconName = `${mediaType}MutedIcon`;
|
2017-04-11 17:00:41 +00:00
|
|
|
iconStyle = styles.whitePrimaryToolbarButtonIcon;
|
|
|
|
style = styles.whitePrimaryToolbarButton;
|
2017-02-16 23:02:40 +00:00
|
|
|
} else {
|
2018-02-19 22:52:21 +00:00
|
|
|
iconName = `${mediaType}Icon`;
|
2017-04-11 17:00:41 +00:00
|
|
|
iconStyle = styles.primaryToolbarButtonIcon;
|
|
|
|
style = styles.primaryToolbarButton;
|
2017-02-16 23:02:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
2018-02-19 22:52:21 +00:00
|
|
|
|
|
|
|
// $FlowExpectedError
|
|
|
|
iconName: this[iconName],
|
2017-02-16 23:02:40 +00:00
|
|
|
iconStyle,
|
|
|
|
style
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-02-19 22:52:21 +00:00
|
|
|
_onToggleAudio: () => void;
|
|
|
|
|
2017-08-04 21:06:42 +00:00
|
|
|
/**
|
|
|
|
* Dispatches an action to toggle the mute state of the audio/microphone.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onToggleAudio() {
|
2017-10-09 21:40:38 +00:00
|
|
|
const mute = !this.props._audioMuted;
|
|
|
|
|
2018-01-03 21:24:07 +00:00
|
|
|
sendAnalytics(createToolbarEvent(
|
|
|
|
AUDIO_MUTE,
|
|
|
|
{
|
|
|
|
enable: mute
|
|
|
|
}));
|
2017-10-09 21:40:38 +00:00
|
|
|
|
2017-08-04 21:06:42 +00:00
|
|
|
// The user sees the reality i.e. the state of base/tracks and intends
|
|
|
|
// to change reality by tapping on the respective button i.e. the user
|
|
|
|
// sets the state of base/media. Whether the user's intention will turn
|
|
|
|
// into reality is a whole different story which is of no concern to the
|
|
|
|
// tapping.
|
2017-08-14 13:27:24 +00:00
|
|
|
this.props.dispatch(
|
|
|
|
setAudioMuted(
|
2017-10-09 21:40:38 +00:00
|
|
|
mute,
|
2017-08-14 13:27:24 +00:00
|
|
|
VIDEO_MUTISM_AUTHORITY.USER,
|
|
|
|
/* ensureTrack */ true));
|
2017-08-04 21:06:42 +00:00
|
|
|
}
|
|
|
|
|
2018-02-19 22:52:21 +00:00
|
|
|
_onToggleVideo: () => void;
|
|
|
|
|
2017-08-04 21:06:42 +00:00
|
|
|
/**
|
|
|
|
* Dispatches an action to toggle the mute state of the video/camera.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onToggleVideo() {
|
2017-10-09 21:40:38 +00:00
|
|
|
const mute = !this.props._videoMuted;
|
|
|
|
|
2018-01-03 21:24:07 +00:00
|
|
|
sendAnalytics(createToolbarEvent(
|
|
|
|
VIDEO_MUTE,
|
|
|
|
{
|
|
|
|
enable: mute
|
|
|
|
}));
|
2017-10-09 21:40:38 +00:00
|
|
|
|
2017-08-04 21:06:42 +00:00
|
|
|
// The user sees the reality i.e. the state of base/tracks and intends
|
|
|
|
// to change reality by tapping on the respective button i.e. the user
|
|
|
|
// sets the state of base/media. Whether the user's intention will turn
|
|
|
|
// into reality is a whole different story which is of no concern to the
|
|
|
|
// tapping.
|
2017-08-14 13:27:24 +00:00
|
|
|
this.props.dispatch(
|
|
|
|
setVideoMuted(
|
|
|
|
!this.props._videoMuted,
|
|
|
|
VIDEO_MUTISM_AUTHORITY.USER,
|
|
|
|
/* ensureTrack */ true));
|
2017-08-04 21:06:42 +00:00
|
|
|
}
|
|
|
|
|
2016-12-11 23:39:31 +00:00
|
|
|
/**
|
|
|
|
* Renders the toolbar which contains the primary buttons such as hangup,
|
|
|
|
* audio and video mute.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
_renderPrimaryToolbar() {
|
2016-10-05 14:36:59 +00:00
|
|
|
const audioButtonStyles = this._getMuteButtonStyles(MEDIA_TYPE.AUDIO);
|
|
|
|
const videoButtonStyles = this._getMuteButtonStyles(MEDIA_TYPE.VIDEO);
|
|
|
|
|
|
|
|
/* eslint-disable react/jsx-handler-names */
|
|
|
|
|
|
|
|
return (
|
2017-11-07 23:26:23 +00:00
|
|
|
<View
|
|
|
|
key = 'primaryToolbar'
|
|
|
|
style = { styles.primaryToolbar }>
|
2016-12-11 23:39:31 +00:00
|
|
|
<ToolbarButton
|
|
|
|
iconName = { audioButtonStyles.iconName }
|
|
|
|
iconStyle = { audioButtonStyles.iconStyle }
|
2017-08-04 21:06:42 +00:00
|
|
|
onClick = { this._onToggleAudio }
|
2016-12-12 19:49:23 +00:00
|
|
|
style = { audioButtonStyles.style } />
|
2016-12-11 23:39:31 +00:00
|
|
|
<ToolbarButton
|
2017-11-28 17:50:34 +00:00
|
|
|
accessibilityLabel = 'Hangup'
|
2016-12-11 23:39:31 +00:00
|
|
|
iconName = 'hangup'
|
2017-04-11 17:00:41 +00:00
|
|
|
iconStyle = { styles.whitePrimaryToolbarButtonIcon }
|
2017-02-16 23:02:40 +00:00
|
|
|
onClick = { this.props._onHangup }
|
2017-04-11 17:00:41 +00:00
|
|
|
style = { styles.hangup }
|
2016-12-11 23:39:31 +00:00
|
|
|
underlayColor = { ColorPalette.buttonUnderlay } />
|
|
|
|
<ToolbarButton
|
2017-07-19 21:25:06 +00:00
|
|
|
disabled = { this.props._audioOnly }
|
2016-12-11 23:39:31 +00:00
|
|
|
iconName = { videoButtonStyles.iconName }
|
|
|
|
iconStyle = { videoButtonStyles.iconStyle }
|
2017-08-04 21:06:42 +00:00
|
|
|
onClick = { this._onToggleVideo }
|
2016-12-12 19:49:23 +00:00
|
|
|
style = { videoButtonStyles.style } />
|
2016-12-11 23:39:31 +00:00
|
|
|
</View>
|
|
|
|
);
|
2016-10-05 14:36:59 +00:00
|
|
|
|
2016-12-11 23:39:31 +00:00
|
|
|
/* eslint-enable react/jsx-handler-names */
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders the toolbar which contains the secondary buttons such as toggle
|
|
|
|
* camera facing mode.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
_renderSecondaryToolbar() {
|
2017-04-11 17:00:41 +00:00
|
|
|
const iconStyle = styles.secondaryToolbarButtonIcon;
|
2016-12-12 19:49:23 +00:00
|
|
|
const style = styles.secondaryToolbarButton;
|
|
|
|
const underlayColor = 'transparent';
|
2017-07-19 12:30:36 +00:00
|
|
|
const {
|
|
|
|
_audioOnly: audioOnly,
|
|
|
|
_videoMuted: videoMuted
|
|
|
|
} = this.props;
|
2016-12-12 19:49:23 +00:00
|
|
|
|
|
|
|
/* eslint-disable react/jsx-curly-spacing,react/jsx-handler-names */
|
2016-12-11 23:39:31 +00:00
|
|
|
|
|
|
|
return (
|
2017-11-07 23:26:23 +00:00
|
|
|
<View
|
|
|
|
key = 'secondaryToolbar'
|
|
|
|
style = { styles.secondaryToolbar }>
|
2017-11-14 20:18:16 +00:00
|
|
|
{
|
|
|
|
AudioRouteButton
|
|
|
|
&& <AudioRouteButton
|
|
|
|
iconName = { 'volume' }
|
|
|
|
iconStyle = { iconStyle }
|
|
|
|
style = { style }
|
|
|
|
underlayColor = { underlayColor } />
|
|
|
|
}
|
2016-12-11 23:39:31 +00:00
|
|
|
<ToolbarButton
|
2017-07-19 12:30:36 +00:00
|
|
|
disabled = { audioOnly || videoMuted }
|
2016-12-14 22:15:17 +00:00
|
|
|
iconName = 'switch-camera'
|
2016-12-12 19:49:23 +00:00
|
|
|
iconStyle = { iconStyle }
|
2017-02-16 23:02:40 +00:00
|
|
|
onClick = { this.props._onToggleCameraFacingMode }
|
2016-12-12 19:49:23 +00:00
|
|
|
style = { style }
|
|
|
|
underlayColor = { underlayColor } />
|
|
|
|
<ToolbarButton
|
2017-11-14 20:18:16 +00:00
|
|
|
iconName = { audioOnly ? 'visibility-off' : 'visibility' }
|
2016-12-12 19:49:23 +00:00
|
|
|
iconStyle = { iconStyle }
|
2017-11-14 20:18:16 +00:00
|
|
|
onClick = { this.props._onToggleAudioOnly }
|
2016-12-12 19:49:23 +00:00
|
|
|
style = { style }
|
|
|
|
underlayColor = { underlayColor } />
|
2017-03-29 12:07:05 +00:00
|
|
|
<ToolbarButton
|
2017-11-14 20:18:16 +00:00
|
|
|
iconName = {
|
|
|
|
this.props._locked ? 'security-locked' : 'security'
|
|
|
|
}
|
2017-07-03 07:00:41 +00:00
|
|
|
iconStyle = { iconStyle }
|
2017-11-14 20:18:16 +00:00
|
|
|
onClick = { this.props._onRoomLock }
|
2017-03-29 12:07:05 +00:00
|
|
|
style = { style }
|
|
|
|
underlayColor = { underlayColor } />
|
2017-09-07 17:25:08 +00:00
|
|
|
{
|
|
|
|
_SHARE_ROOM_TOOLBAR_BUTTON
|
|
|
|
&& <ToolbarButton
|
|
|
|
iconName = 'link'
|
|
|
|
iconStyle = { iconStyle }
|
|
|
|
onClick = { this.props._onShareRoom }
|
|
|
|
style = { style }
|
|
|
|
underlayColor = { underlayColor } />
|
|
|
|
}
|
2018-02-19 22:52:21 +00:00
|
|
|
<EnterPictureInPictureToolbarButton
|
|
|
|
iconStyle = { iconStyle }
|
|
|
|
style = { style }
|
|
|
|
underlayColor = { underlayColor } />
|
2016-12-11 23:39:31 +00:00
|
|
|
</View>
|
2016-10-05 14:36:59 +00:00
|
|
|
);
|
|
|
|
|
2016-12-12 19:49:23 +00:00
|
|
|
/* eslint-enable react/jsx-curly-spacing,react/jsx-handler-names */
|
2016-10-05 14:36:59 +00:00
|
|
|
}
|
2017-10-19 18:29:34 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-07 14:28:08 +00:00
|
|
|
* Renders the primary and the secondary toolbars.
|
2017-10-19 18:29:34 +00:00
|
|
|
*
|
|
|
|
* @private
|
2017-11-07 14:28:08 +00:00
|
|
|
* @returns {[ReactElement, ReactElement]}
|
2017-10-19 18:29:34 +00:00
|
|
|
*/
|
|
|
|
_renderToolbars() {
|
2017-11-07 14:28:08 +00:00
|
|
|
return [
|
|
|
|
this._renderSecondaryToolbar(),
|
|
|
|
this._renderPrimaryToolbar()
|
|
|
|
];
|
2017-10-19 18:29:34 +00:00
|
|
|
}
|
2016-10-05 14:36:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Additional properties for various icons, which are now platform-dependent.
|
|
|
|
* This is done to have common logic of generating styles for web and native.
|
|
|
|
* TODO As soon as we have common font sets for web and native, this will no
|
|
|
|
* longer be required.
|
|
|
|
*/
|
2018-02-19 22:52:21 +00:00
|
|
|
// $FlowExpectedError
|
2017-04-01 05:52:40 +00:00
|
|
|
Object.assign(Toolbox.prototype, {
|
2016-10-05 14:36:59 +00:00
|
|
|
audioIcon: 'microphone',
|
|
|
|
audioMutedIcon: 'mic-disabled',
|
2016-12-14 22:15:17 +00:00
|
|
|
videoIcon: 'camera',
|
2016-10-05 14:36:59 +00:00
|
|
|
videoMutedIcon: 'camera-disabled'
|
|
|
|
});
|
|
|
|
|
2017-02-16 23:02:40 +00:00
|
|
|
/**
|
2018-02-19 22:52:21 +00:00
|
|
|
* Maps redux actions to {@link Toolbox}'s React {@code Component} props.
|
2017-02-16 23:02:40 +00:00
|
|
|
*
|
2018-02-19 22:52:21 +00:00
|
|
|
* @param {Function} dispatch - The redux action {@code dispatch} function.
|
|
|
|
* @private
|
2017-02-16 23:02:40 +00:00
|
|
|
* @returns {{
|
|
|
|
* _onRoomLock: Function,
|
2017-03-29 12:07:05 +00:00
|
|
|
* _onToggleAudioOnly: Function,
|
2017-02-16 23:02:40 +00:00
|
|
|
* _onToggleCameraFacingMode: Function,
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
function _mapDispatchToProps(dispatch) {
|
|
|
|
return {
|
|
|
|
...abstractMapDispatchToProps(dispatch),
|
|
|
|
|
|
|
|
/**
|
2017-03-29 12:07:05 +00:00
|
|
|
* Sets the lock i.e. password protection of the conference/room.
|
2017-02-16 23:02:40 +00:00
|
|
|
*
|
|
|
|
* @private
|
2017-08-14 10:23:46 +00:00
|
|
|
* @returns {void}
|
2017-02-16 23:02:40 +00:00
|
|
|
* @type {Function}
|
|
|
|
*/
|
|
|
|
_onRoomLock() {
|
2017-07-17 15:33:49 +00:00
|
|
|
dispatch(beginRoomLockRequest());
|
2017-02-16 23:02:40 +00:00
|
|
|
},
|
|
|
|
|
2017-01-31 09:52:29 +00:00
|
|
|
/**
|
|
|
|
* Begins the UI procedure to share the conference/room URL.
|
|
|
|
*
|
|
|
|
* @private
|
2017-08-14 10:23:46 +00:00
|
|
|
* @returns {void}
|
2017-01-31 09:52:29 +00:00
|
|
|
* @type {Function}
|
|
|
|
*/
|
|
|
|
_onShareRoom() {
|
2017-07-17 15:33:49 +00:00
|
|
|
dispatch(beginShareRoom());
|
2017-01-31 09:52:29 +00:00
|
|
|
},
|
|
|
|
|
2017-02-16 23:02:40 +00:00
|
|
|
/**
|
2017-03-29 12:07:05 +00:00
|
|
|
* Toggles the audio-only flag of the conference.
|
|
|
|
*
|
|
|
|
* @private
|
2017-08-14 10:23:46 +00:00
|
|
|
* @returns {void}
|
2017-03-29 12:07:05 +00:00
|
|
|
* @type {Function}
|
|
|
|
*/
|
|
|
|
_onToggleAudioOnly() {
|
2017-07-17 15:33:49 +00:00
|
|
|
dispatch(toggleAudioOnly());
|
2017-03-29 12:07:05 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Switches between the front/user-facing and back/environment-facing
|
2017-02-16 23:02:40 +00:00
|
|
|
* cameras.
|
|
|
|
*
|
|
|
|
* @private
|
2017-08-14 10:23:46 +00:00
|
|
|
* @returns {void}
|
2017-02-16 23:02:40 +00:00
|
|
|
* @type {Function}
|
|
|
|
*/
|
|
|
|
_onToggleCameraFacingMode() {
|
2017-07-17 15:33:49 +00:00
|
|
|
dispatch(toggleCameraFacingMode());
|
2017-02-16 23:02:40 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-02-19 22:52:21 +00:00
|
|
|
* Maps (parts of) the redux state to {@link Toolbox}'s React {@code Component}
|
|
|
|
* props.
|
2017-02-16 23:02:40 +00:00
|
|
|
*
|
2018-02-19 22:52:21 +00:00
|
|
|
* @param {Object} state - The redux store/state.
|
|
|
|
* @private
|
2017-02-16 23:02:40 +00:00
|
|
|
* @returns {{
|
2017-07-03 07:06:33 +00:00
|
|
|
* _audioOnly: boolean,
|
2018-02-19 22:52:21 +00:00
|
|
|
* _enabled: boolean,
|
2017-02-16 23:02:40 +00:00
|
|
|
* _locked: boolean
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
function _mapStateToProps(state) {
|
|
|
|
const conference = state['features/base/conference'];
|
2018-02-06 10:41:23 +00:00
|
|
|
const { enabled } = state['features/toolbox'];
|
2017-02-16 23:02:40 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
...abstractMapStateToProps(state),
|
|
|
|
|
2017-07-03 07:06:33 +00:00
|
|
|
/**
|
|
|
|
* The indicator which determines whether the conference is in
|
|
|
|
* audio-only mode.
|
|
|
|
*
|
|
|
|
* @protected
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
|
|
|
_audioOnly: Boolean(conference.audioOnly),
|
|
|
|
|
2018-02-06 10:41:23 +00:00
|
|
|
/**
|
2018-02-12 17:49:45 +00:00
|
|
|
* The indicator which determines whether the toolbox is enabled.
|
2018-02-06 10:41:23 +00:00
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
|
|
|
_enabled: enabled,
|
|
|
|
|
2017-02-16 23:02:40 +00:00
|
|
|
/**
|
|
|
|
* The indicator which determines whether the conference is
|
|
|
|
* locked/password-protected.
|
|
|
|
*
|
|
|
|
* @protected
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
2018-02-19 22:52:21 +00:00
|
|
|
_locked: Boolean(conference.locked)
|
2017-02-16 23:02:40 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-10-13 16:13:46 +00:00
|
|
|
export default connect(_mapStateToProps, _mapDispatchToProps)(
|
2017-11-03 20:14:38 +00:00
|
|
|
makeAspectRatioAware(Toolbox));
|