Selaa lähdekoodia

invite: merge InviteButton and InfoDialogButton on mobile

master
Saúl Ibarra Corretgé 5 vuotta sitten
vanhempi
commit
8cd881945a

+ 15
- 6
react/features/invite/components/add-people-dialog/native/InviteButton.js Näytä tiedosto

@@ -8,12 +8,18 @@ import { IconAddPeople } from '../../../../base/icons';
8 8
 import { connect } from '../../../../base/redux';
9 9
 import { AbstractButton } from '../../../../base/toolbox';
10 10
 import type { AbstractButtonProps } from '../../../../base/toolbox';
11
+import { beginShareRoom } from '../../../../share-room';
11 12
 
12 13
 import { setAddPeopleDialogVisible } from '../../../actions';
13 14
 import { isAddPeopleEnabled, isDialOutEnabled } from '../../../functions';
14 15
 
15 16
 type Props = AbstractButtonProps & {
16 17
 
18
+    /**
19
+     * Whether the (backend) add people feature is enabled or not.
20
+     */
21
+    _addPeopleEnabled: boolean,
22
+
17 23
     /**
18 24
      * The Redux dispatch function.
19 25
      */
@@ -36,7 +42,13 @@ class InviteButton extends AbstractButton<Props, *> {
36 42
      * @returns {void}
37 43
      */
38 44
     _handleClick() {
39
-        this.props.dispatch(setAddPeopleDialogVisible(true));
45
+        const { _addPeopleEnabled, dispatch } = this.props;
46
+
47
+        if (_addPeopleEnabled) {
48
+            dispatch(setAddPeopleDialogVisible(true));
49
+        } else {
50
+            dispatch(beginShareRoom());
51
+        }
40 52
     }
41 53
 }
42 54
 
@@ -45,18 +57,15 @@ class InviteButton extends AbstractButton<Props, *> {
45 57
  * props.
46 58
  *
47 59
  * @param {Object} state - The redux store/state.
48
- * @param {Object} ownProps - The properties explicitly passed to the component
49
- * instance.
50 60
  * @private
51 61
  * @returns {Object}
52 62
  */
53
-function _mapStateToProps(state: Object, ownProps: Object) {
63
+function _mapStateToProps(state: Object) {
54 64
     const addPeopleEnabled = getFeatureFlag(state, INVITE_ENABLED, true)
55 65
         && (isAddPeopleEnabled(state) || isDialOutEnabled(state));
56
-    const { visible = Boolean(addPeopleEnabled) } = ownProps;
57 66
 
58 67
     return {
59
-        visible
68
+        _addPeopleEnabled: addPeopleEnabled
60 69
     };
61 70
 }
62 71
 

+ 0
- 3
react/features/invite/components/info-dialog/index.native.js Näytä tiedosto

@@ -1,3 +0,0 @@
1
-// @flow
2
-
3
-export * from './native';

+ 0
- 39
react/features/invite/components/info-dialog/native/InfoDialogButton.js Näytä tiedosto

@@ -1,39 +0,0 @@
1
-// @flow
2
-
3
-import type { Dispatch } from 'redux';
4
-
5
-import { translate } from '../../../../base/i18n';
6
-import { IconInfo } from '../../../../base/icons';
7
-import { connect } from '../../../../base/redux';
8
-import { AbstractButton } from '../../../../base/toolbox';
9
-import type { AbstractButtonProps } from '../../../../base/toolbox';
10
-import { beginShareRoom } from '../../../../share-room';
11
-
12
-type Props = AbstractButtonProps & {
13
-
14
-    /**
15
-     * The Redux dispatch function.
16
-     */
17
-    dispatch: Dispatch<any>
18
-};
19
-
20
-/**
21
- * Implements an {@link AbstractButton} to open the info dialog of the meeting.
22
- */
23
-class InfoDialogButton extends AbstractButton<Props, *> {
24
-    accessibilityLabel = 'info.accessibilityLabel';
25
-    icon = IconInfo;
26
-    label = 'info.label';
27
-
28
-    /**
29
-     * Handles clicking / pressing the button, and opens the appropriate dialog.
30
-     *
31
-     * @private
32
-     * @returns {void}
33
-     */
34
-    _handleClick() {
35
-        this.props.dispatch(beginShareRoom());
36
-    }
37
-}
38
-
39
-export default translate(connect()(InfoDialogButton));

+ 0
- 3
react/features/invite/components/info-dialog/native/index.js Näytä tiedosto

@@ -1,3 +0,0 @@
1
-// @flow
2
-
3
-export { default as InfoDialogButton } from './InfoDialogButton';

+ 2
- 12
react/features/toolbox/components/native/OverflowMenu.js Näytä tiedosto

@@ -7,11 +7,11 @@ import Collapsible from 'react-native-collapsible';
7 7
 import { ColorSchemeRegistry } from '../../../base/color-scheme';
8 8
 import { BottomSheet, hideDialog, isDialogOpen } from '../../../base/dialog';
9 9
 import { IconDragHandle } from '../../../base/icons';
10
-import { CHAT_ENABLED, IOS_RECORDING_ENABLED, getFeatureFlag } from '../../../base/flags';
10
+import { IOS_RECORDING_ENABLED, getFeatureFlag } from '../../../base/flags';
11 11
 import { connect } from '../../../base/redux';
12 12
 import { StyleType } from '../../../base/styles';
13 13
 import { SharedDocumentButton } from '../../../etherpad';
14
-import { InfoDialogButton, InviteButton } from '../../../invite';
14
+import { InviteButton } from '../../../invite';
15 15
 import { AudioRouteButton } from '../../../mobile/audio-mode';
16 16
 import { LiveStreamButton, RecordButton } from '../../../recording';
17 17
 import { RoomLockButton } from '../../../room-lock';
@@ -36,11 +36,6 @@ type Props = {
36 36
      */
37 37
     _bottomSheetStyles: StyleType,
38 38
 
39
-    /**
40
-     * Whether the chat feature has been enabled. The meeting info button will be displayed in its place when disabled.
41
-     */
42
-    _chatEnabled: boolean,
43
-
44 39
     /**
45 40
      * True if the overflow menu is currently visible, false otherwise.
46 41
      */
@@ -145,10 +140,6 @@ class OverflowMenu extends PureComponent<Props, State> {
145 140
                     <LiveStreamButton { ...buttonProps } />
146 141
                     <TileViewButton { ...buttonProps } />
147 142
                     <InviteButton { ...buttonProps } />
148
-                    {
149
-                        this.props._chatEnabled
150
-                            && <InfoDialogButton { ...buttonProps } />
151
-                    }
152 143
                     <RaiseHandButton { ...buttonProps } />
153 144
                     <SharedDocumentButton { ...buttonProps } />
154 145
                     <HelpButton { ...buttonProps } />
@@ -249,7 +240,6 @@ class OverflowMenu extends PureComponent<Props, State> {
249 240
 function _mapStateToProps(state) {
250 241
     return {
251 242
         _bottomSheetStyles: ColorSchemeRegistry.get(state, 'BottomSheet'),
252
-        _chatEnabled: getFeatureFlag(state, CHAT_ENABLED, true),
253 243
         _isOpen: isDialogOpen(state, OverflowMenu_),
254 244
         _recordingEnabled: Platform.OS !== 'ios' || getFeatureFlag(state, IOS_RECORDING_ENABLED)
255 245
     };

+ 2
- 2
react/features/toolbox/components/native/Toolbox.js Näytä tiedosto

@@ -9,7 +9,7 @@ import { Container } from '../../../base/react';
9 9
 import { connect } from '../../../base/redux';
10 10
 import { StyleType } from '../../../base/styles';
11 11
 import { ChatButton } from '../../../chat';
12
-import { InfoDialogButton } from '../../../invite';
12
+import { InviteButton } from '../../../invite';
13 13
 
14 14
 import { isToolboxVisible } from '../../functions';
15 15
 
@@ -122,7 +122,7 @@ class Toolbox extends PureComponent<Props> {
122 122
                 }
123 123
                 {
124 124
                     !_chatEnabled
125
-                        && <InfoDialogButton
125
+                        && <InviteButton
126 126
                             styles = { buttonStyles }
127 127
                             toggledStyles = { toggledButtonStyles } />
128 128
                 }

Loading…
Peruuta
Tallenna