瀏覽代碼

invite: merge InviteButton and InfoDialogButton on mobile

master
Saúl Ibarra Corretgé 5 年之前
父節點
當前提交
8cd881945a

+ 15
- 6
react/features/invite/components/add-people-dialog/native/InviteButton.js 查看文件

8
 import { connect } from '../../../../base/redux';
8
 import { connect } from '../../../../base/redux';
9
 import { AbstractButton } from '../../../../base/toolbox';
9
 import { AbstractButton } from '../../../../base/toolbox';
10
 import type { AbstractButtonProps } from '../../../../base/toolbox';
10
 import type { AbstractButtonProps } from '../../../../base/toolbox';
11
+import { beginShareRoom } from '../../../../share-room';
11
 
12
 
12
 import { setAddPeopleDialogVisible } from '../../../actions';
13
 import { setAddPeopleDialogVisible } from '../../../actions';
13
 import { isAddPeopleEnabled, isDialOutEnabled } from '../../../functions';
14
 import { isAddPeopleEnabled, isDialOutEnabled } from '../../../functions';
14
 
15
 
15
 type Props = AbstractButtonProps & {
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
      * The Redux dispatch function.
24
      * The Redux dispatch function.
19
      */
25
      */
36
      * @returns {void}
42
      * @returns {void}
37
      */
43
      */
38
     _handleClick() {
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
  * props.
57
  * props.
46
  *
58
  *
47
  * @param {Object} state - The redux store/state.
59
  * @param {Object} state - The redux store/state.
48
- * @param {Object} ownProps - The properties explicitly passed to the component
49
- * instance.
50
  * @private
60
  * @private
51
  * @returns {Object}
61
  * @returns {Object}
52
  */
62
  */
53
-function _mapStateToProps(state: Object, ownProps: Object) {
63
+function _mapStateToProps(state: Object) {
54
     const addPeopleEnabled = getFeatureFlag(state, INVITE_ENABLED, true)
64
     const addPeopleEnabled = getFeatureFlag(state, INVITE_ENABLED, true)
55
         && (isAddPeopleEnabled(state) || isDialOutEnabled(state));
65
         && (isAddPeopleEnabled(state) || isDialOutEnabled(state));
56
-    const { visible = Boolean(addPeopleEnabled) } = ownProps;
57
 
66
 
58
     return {
67
     return {
59
-        visible
68
+        _addPeopleEnabled: addPeopleEnabled
60
     };
69
     };
61
 }
70
 }
62
 
71
 

+ 0
- 3
react/features/invite/components/info-dialog/index.native.js 查看文件

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

+ 0
- 39
react/features/invite/components/info-dialog/native/InfoDialogButton.js 查看文件

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 查看文件

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

+ 2
- 12
react/features/toolbox/components/native/OverflowMenu.js 查看文件

7
 import { ColorSchemeRegistry } from '../../../base/color-scheme';
7
 import { ColorSchemeRegistry } from '../../../base/color-scheme';
8
 import { BottomSheet, hideDialog, isDialogOpen } from '../../../base/dialog';
8
 import { BottomSheet, hideDialog, isDialogOpen } from '../../../base/dialog';
9
 import { IconDragHandle } from '../../../base/icons';
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
 import { connect } from '../../../base/redux';
11
 import { connect } from '../../../base/redux';
12
 import { StyleType } from '../../../base/styles';
12
 import { StyleType } from '../../../base/styles';
13
 import { SharedDocumentButton } from '../../../etherpad';
13
 import { SharedDocumentButton } from '../../../etherpad';
14
-import { InfoDialogButton, InviteButton } from '../../../invite';
14
+import { InviteButton } from '../../../invite';
15
 import { AudioRouteButton } from '../../../mobile/audio-mode';
15
 import { AudioRouteButton } from '../../../mobile/audio-mode';
16
 import { LiveStreamButton, RecordButton } from '../../../recording';
16
 import { LiveStreamButton, RecordButton } from '../../../recording';
17
 import { RoomLockButton } from '../../../room-lock';
17
 import { RoomLockButton } from '../../../room-lock';
36
      */
36
      */
37
     _bottomSheetStyles: StyleType,
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
      * True if the overflow menu is currently visible, false otherwise.
40
      * True if the overflow menu is currently visible, false otherwise.
46
      */
41
      */
145
                     <LiveStreamButton { ...buttonProps } />
140
                     <LiveStreamButton { ...buttonProps } />
146
                     <TileViewButton { ...buttonProps } />
141
                     <TileViewButton { ...buttonProps } />
147
                     <InviteButton { ...buttonProps } />
142
                     <InviteButton { ...buttonProps } />
148
-                    {
149
-                        this.props._chatEnabled
150
-                            && <InfoDialogButton { ...buttonProps } />
151
-                    }
152
                     <RaiseHandButton { ...buttonProps } />
143
                     <RaiseHandButton { ...buttonProps } />
153
                     <SharedDocumentButton { ...buttonProps } />
144
                     <SharedDocumentButton { ...buttonProps } />
154
                     <HelpButton { ...buttonProps } />
145
                     <HelpButton { ...buttonProps } />
249
 function _mapStateToProps(state) {
240
 function _mapStateToProps(state) {
250
     return {
241
     return {
251
         _bottomSheetStyles: ColorSchemeRegistry.get(state, 'BottomSheet'),
242
         _bottomSheetStyles: ColorSchemeRegistry.get(state, 'BottomSheet'),
252
-        _chatEnabled: getFeatureFlag(state, CHAT_ENABLED, true),
253
         _isOpen: isDialogOpen(state, OverflowMenu_),
243
         _isOpen: isDialogOpen(state, OverflowMenu_),
254
         _recordingEnabled: Platform.OS !== 'ios' || getFeatureFlag(state, IOS_RECORDING_ENABLED)
244
         _recordingEnabled: Platform.OS !== 'ios' || getFeatureFlag(state, IOS_RECORDING_ENABLED)
255
     };
245
     };

+ 2
- 2
react/features/toolbox/components/native/Toolbox.js 查看文件

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

Loading…
取消
儲存