From 8cd881945a582af7f3302aff0c93b0b02f73cb5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Tue, 24 Mar 2020 12:18:25 +0100 Subject: [PATCH] invite: merge InviteButton and InfoDialogButton on mobile --- .../add-people-dialog/native/InviteButton.js | 21 +++++++--- .../components/info-dialog/index.native.js | 3 -- .../info-dialog/native/InfoDialogButton.js | 39 ------------------- .../components/info-dialog/native/index.js | 3 -- .../toolbox/components/native/OverflowMenu.js | 14 +------ .../toolbox/components/native/Toolbox.js | 4 +- 6 files changed, 19 insertions(+), 65 deletions(-) delete mode 100644 react/features/invite/components/info-dialog/native/InfoDialogButton.js delete mode 100644 react/features/invite/components/info-dialog/native/index.js diff --git a/react/features/invite/components/add-people-dialog/native/InviteButton.js b/react/features/invite/components/add-people-dialog/native/InviteButton.js index 1a3949f28..57bc0f163 100644 --- a/react/features/invite/components/add-people-dialog/native/InviteButton.js +++ b/react/features/invite/components/add-people-dialog/native/InviteButton.js @@ -8,12 +8,18 @@ import { IconAddPeople } from '../../../../base/icons'; import { connect } from '../../../../base/redux'; import { AbstractButton } from '../../../../base/toolbox'; import type { AbstractButtonProps } from '../../../../base/toolbox'; +import { beginShareRoom } from '../../../../share-room'; import { setAddPeopleDialogVisible } from '../../../actions'; import { isAddPeopleEnabled, isDialOutEnabled } from '../../../functions'; type Props = AbstractButtonProps & { + /** + * Whether the (backend) add people feature is enabled or not. + */ + _addPeopleEnabled: boolean, + /** * The Redux dispatch function. */ @@ -36,7 +42,13 @@ class InviteButton extends AbstractButton { * @returns {void} */ _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. * * @param {Object} state - The redux store/state. - * @param {Object} ownProps - The properties explicitly passed to the component - * instance. * @private * @returns {Object} */ -function _mapStateToProps(state: Object, ownProps: Object) { +function _mapStateToProps(state: Object) { const addPeopleEnabled = getFeatureFlag(state, INVITE_ENABLED, true) && (isAddPeopleEnabled(state) || isDialOutEnabled(state)); - const { visible = Boolean(addPeopleEnabled) } = ownProps; return { - visible + _addPeopleEnabled: addPeopleEnabled }; } diff --git a/react/features/invite/components/info-dialog/index.native.js b/react/features/invite/components/info-dialog/index.native.js index a32ec6061..e69de29bb 100644 --- a/react/features/invite/components/info-dialog/index.native.js +++ b/react/features/invite/components/info-dialog/index.native.js @@ -1,3 +0,0 @@ -// @flow - -export * from './native'; diff --git a/react/features/invite/components/info-dialog/native/InfoDialogButton.js b/react/features/invite/components/info-dialog/native/InfoDialogButton.js deleted file mode 100644 index b954c506b..000000000 --- a/react/features/invite/components/info-dialog/native/InfoDialogButton.js +++ /dev/null @@ -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 -}; - -/** - * Implements an {@link AbstractButton} to open the info dialog of the meeting. - */ -class InfoDialogButton extends AbstractButton { - 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)); diff --git a/react/features/invite/components/info-dialog/native/index.js b/react/features/invite/components/info-dialog/native/index.js deleted file mode 100644 index 716ff1f95..000000000 --- a/react/features/invite/components/info-dialog/native/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// @flow - -export { default as InfoDialogButton } from './InfoDialogButton'; diff --git a/react/features/toolbox/components/native/OverflowMenu.js b/react/features/toolbox/components/native/OverflowMenu.js index b37b511cf..26d820253 100644 --- a/react/features/toolbox/components/native/OverflowMenu.js +++ b/react/features/toolbox/components/native/OverflowMenu.js @@ -7,11 +7,11 @@ import Collapsible from 'react-native-collapsible'; import { ColorSchemeRegistry } from '../../../base/color-scheme'; import { BottomSheet, hideDialog, isDialogOpen } from '../../../base/dialog'; 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 { StyleType } from '../../../base/styles'; import { SharedDocumentButton } from '../../../etherpad'; -import { InfoDialogButton, InviteButton } from '../../../invite'; +import { InviteButton } from '../../../invite'; import { AudioRouteButton } from '../../../mobile/audio-mode'; import { LiveStreamButton, RecordButton } from '../../../recording'; import { RoomLockButton } from '../../../room-lock'; @@ -36,11 +36,6 @@ type Props = { */ _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. */ @@ -145,10 +140,6 @@ class OverflowMenu extends PureComponent { - { - this.props._chatEnabled - && - } @@ -249,7 +240,6 @@ class OverflowMenu extends PureComponent { function _mapStateToProps(state) { return { _bottomSheetStyles: ColorSchemeRegistry.get(state, 'BottomSheet'), - _chatEnabled: getFeatureFlag(state, CHAT_ENABLED, true), _isOpen: isDialogOpen(state, OverflowMenu_), _recordingEnabled: Platform.OS !== 'ios' || getFeatureFlag(state, IOS_RECORDING_ENABLED) }; diff --git a/react/features/toolbox/components/native/Toolbox.js b/react/features/toolbox/components/native/Toolbox.js index c3ceb9b7c..f808ef24e 100644 --- a/react/features/toolbox/components/native/Toolbox.js +++ b/react/features/toolbox/components/native/Toolbox.js @@ -9,7 +9,7 @@ import { Container } from '../../../base/react'; import { connect } from '../../../base/redux'; import { StyleType } from '../../../base/styles'; import { ChatButton } from '../../../chat'; -import { InfoDialogButton } from '../../../invite'; +import { InviteButton } from '../../../invite'; import { isToolboxVisible } from '../../functions'; @@ -122,7 +122,7 @@ class Toolbox extends PureComponent { } { !_chatEnabled - && }