invite: merge InviteButton and InfoDialogButton on mobile
This commit is contained in:
parent
579d08e27e
commit
8cd881945a
@ -8,12 +8,18 @@ import { IconAddPeople } from '../../../../base/icons';
|
|||||||
import { connect } from '../../../../base/redux';
|
import { connect } from '../../../../base/redux';
|
||||||
import { AbstractButton } from '../../../../base/toolbox';
|
import { AbstractButton } from '../../../../base/toolbox';
|
||||||
import type { AbstractButtonProps } from '../../../../base/toolbox';
|
import type { AbstractButtonProps } from '../../../../base/toolbox';
|
||||||
|
import { beginShareRoom } from '../../../../share-room';
|
||||||
|
|
||||||
import { setAddPeopleDialogVisible } from '../../../actions';
|
import { setAddPeopleDialogVisible } from '../../../actions';
|
||||||
import { isAddPeopleEnabled, isDialOutEnabled } from '../../../functions';
|
import { isAddPeopleEnabled, isDialOutEnabled } from '../../../functions';
|
||||||
|
|
||||||
type Props = AbstractButtonProps & {
|
type Props = AbstractButtonProps & {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the (backend) add people feature is enabled or not.
|
||||||
|
*/
|
||||||
|
_addPeopleEnabled: boolean,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Redux dispatch function.
|
* The Redux dispatch function.
|
||||||
*/
|
*/
|
||||||
@ -36,7 +42,13 @@ class InviteButton extends AbstractButton<Props, *> {
|
|||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
_handleClick() {
|
_handleClick() {
|
||||||
this.props.dispatch(setAddPeopleDialogVisible(true));
|
const { _addPeopleEnabled, dispatch } = this.props;
|
||||||
|
|
||||||
|
if (_addPeopleEnabled) {
|
||||||
|
dispatch(setAddPeopleDialogVisible(true));
|
||||||
|
} else {
|
||||||
|
dispatch(beginShareRoom());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,18 +57,15 @@ class InviteButton extends AbstractButton<Props, *> {
|
|||||||
* props.
|
* props.
|
||||||
*
|
*
|
||||||
* @param {Object} state - The redux store/state.
|
* @param {Object} state - The redux store/state.
|
||||||
* @param {Object} ownProps - The properties explicitly passed to the component
|
|
||||||
* instance.
|
|
||||||
* @private
|
* @private
|
||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
function _mapStateToProps(state: Object, ownProps: Object) {
|
function _mapStateToProps(state: Object) {
|
||||||
const addPeopleEnabled = getFeatureFlag(state, INVITE_ENABLED, true)
|
const addPeopleEnabled = getFeatureFlag(state, INVITE_ENABLED, true)
|
||||||
&& (isAddPeopleEnabled(state) || isDialOutEnabled(state));
|
&& (isAddPeopleEnabled(state) || isDialOutEnabled(state));
|
||||||
const { visible = Boolean(addPeopleEnabled) } = ownProps;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
visible
|
_addPeopleEnabled: addPeopleEnabled
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
// @flow
|
|
||||||
|
|
||||||
export * from './native';
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
// @flow
|
|
||||||
|
|
||||||
import type { Dispatch } from 'redux';
|
|
||||||
|
|
||||||
import { translate } from '../../../../base/i18n';
|
|
||||||
import { IconInfo } from '../../../../base/icons';
|
|
||||||
import { connect } from '../../../../base/redux';
|
|
||||||
import { AbstractButton } from '../../../../base/toolbox';
|
|
||||||
import type { AbstractButtonProps } from '../../../../base/toolbox';
|
|
||||||
import { beginShareRoom } from '../../../../share-room';
|
|
||||||
|
|
||||||
type Props = AbstractButtonProps & {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Redux dispatch function.
|
|
||||||
*/
|
|
||||||
dispatch: Dispatch<any>
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implements an {@link AbstractButton} to open the info dialog of the meeting.
|
|
||||||
*/
|
|
||||||
class InfoDialogButton extends AbstractButton<Props, *> {
|
|
||||||
accessibilityLabel = 'info.accessibilityLabel';
|
|
||||||
icon = IconInfo;
|
|
||||||
label = 'info.label';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles clicking / pressing the button, and opens the appropriate dialog.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
_handleClick() {
|
|
||||||
this.props.dispatch(beginShareRoom());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default translate(connect()(InfoDialogButton));
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
// @flow
|
|
||||||
|
|
||||||
export { default as InfoDialogButton } from './InfoDialogButton';
|
|
||||||
@ -7,11 +7,11 @@ import Collapsible from 'react-native-collapsible';
|
|||||||
import { ColorSchemeRegistry } from '../../../base/color-scheme';
|
import { ColorSchemeRegistry } from '../../../base/color-scheme';
|
||||||
import { BottomSheet, hideDialog, isDialogOpen } from '../../../base/dialog';
|
import { BottomSheet, hideDialog, isDialogOpen } from '../../../base/dialog';
|
||||||
import { IconDragHandle } from '../../../base/icons';
|
import { IconDragHandle } from '../../../base/icons';
|
||||||
import { CHAT_ENABLED, IOS_RECORDING_ENABLED, getFeatureFlag } from '../../../base/flags';
|
import { IOS_RECORDING_ENABLED, getFeatureFlag } from '../../../base/flags';
|
||||||
import { connect } from '../../../base/redux';
|
import { connect } from '../../../base/redux';
|
||||||
import { StyleType } from '../../../base/styles';
|
import { StyleType } from '../../../base/styles';
|
||||||
import { SharedDocumentButton } from '../../../etherpad';
|
import { SharedDocumentButton } from '../../../etherpad';
|
||||||
import { InfoDialogButton, InviteButton } from '../../../invite';
|
import { InviteButton } from '../../../invite';
|
||||||
import { AudioRouteButton } from '../../../mobile/audio-mode';
|
import { AudioRouteButton } from '../../../mobile/audio-mode';
|
||||||
import { LiveStreamButton, RecordButton } from '../../../recording';
|
import { LiveStreamButton, RecordButton } from '../../../recording';
|
||||||
import { RoomLockButton } from '../../../room-lock';
|
import { RoomLockButton } from '../../../room-lock';
|
||||||
@ -36,11 +36,6 @@ type Props = {
|
|||||||
*/
|
*/
|
||||||
_bottomSheetStyles: StyleType,
|
_bottomSheetStyles: StyleType,
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the chat feature has been enabled. The meeting info button will be displayed in its place when disabled.
|
|
||||||
*/
|
|
||||||
_chatEnabled: boolean,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True if the overflow menu is currently visible, false otherwise.
|
* True if the overflow menu is currently visible, false otherwise.
|
||||||
*/
|
*/
|
||||||
@ -145,10 +140,6 @@ class OverflowMenu extends PureComponent<Props, State> {
|
|||||||
<LiveStreamButton { ...buttonProps } />
|
<LiveStreamButton { ...buttonProps } />
|
||||||
<TileViewButton { ...buttonProps } />
|
<TileViewButton { ...buttonProps } />
|
||||||
<InviteButton { ...buttonProps } />
|
<InviteButton { ...buttonProps } />
|
||||||
{
|
|
||||||
this.props._chatEnabled
|
|
||||||
&& <InfoDialogButton { ...buttonProps } />
|
|
||||||
}
|
|
||||||
<RaiseHandButton { ...buttonProps } />
|
<RaiseHandButton { ...buttonProps } />
|
||||||
<SharedDocumentButton { ...buttonProps } />
|
<SharedDocumentButton { ...buttonProps } />
|
||||||
<HelpButton { ...buttonProps } />
|
<HelpButton { ...buttonProps } />
|
||||||
@ -249,7 +240,6 @@ class OverflowMenu extends PureComponent<Props, State> {
|
|||||||
function _mapStateToProps(state) {
|
function _mapStateToProps(state) {
|
||||||
return {
|
return {
|
||||||
_bottomSheetStyles: ColorSchemeRegistry.get(state, 'BottomSheet'),
|
_bottomSheetStyles: ColorSchemeRegistry.get(state, 'BottomSheet'),
|
||||||
_chatEnabled: getFeatureFlag(state, CHAT_ENABLED, true),
|
|
||||||
_isOpen: isDialogOpen(state, OverflowMenu_),
|
_isOpen: isDialogOpen(state, OverflowMenu_),
|
||||||
_recordingEnabled: Platform.OS !== 'ios' || getFeatureFlag(state, IOS_RECORDING_ENABLED)
|
_recordingEnabled: Platform.OS !== 'ios' || getFeatureFlag(state, IOS_RECORDING_ENABLED)
|
||||||
};
|
};
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import { Container } from '../../../base/react';
|
|||||||
import { connect } from '../../../base/redux';
|
import { connect } from '../../../base/redux';
|
||||||
import { StyleType } from '../../../base/styles';
|
import { StyleType } from '../../../base/styles';
|
||||||
import { ChatButton } from '../../../chat';
|
import { ChatButton } from '../../../chat';
|
||||||
import { InfoDialogButton } from '../../../invite';
|
import { InviteButton } from '../../../invite';
|
||||||
|
|
||||||
import { isToolboxVisible } from '../../functions';
|
import { isToolboxVisible } from '../../functions';
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ class Toolbox extends PureComponent<Props> {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
!_chatEnabled
|
!_chatEnabled
|
||||||
&& <InfoDialogButton
|
&& <InviteButton
|
||||||
styles = { buttonStyles }
|
styles = { buttonStyles }
|
||||||
toggledStyles = { toggledButtonStyles } />
|
toggledStyles = { toggledButtonStyles } />
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user