Переглянути джерело

ref: AddPeopleDialog to JitsiModal

j8
Bettenbuk Zoltan 5 роки тому
джерело
коміт
0f4369a9a9

+ 0
- 11
react/features/invite/actionTypes.js Переглянути файл

41
  */
41
  */
42
 export const SET_CALLEE_INFO_VISIBLE = 'SET_CALLEE_INFO_VISIBLE';
42
 export const SET_CALLEE_INFO_VISIBLE = 'SET_CALLEE_INFO_VISIBLE';
43
 
43
 
44
-
45
-/**
46
- * The type of redux action which sets the invite dialog visible or invisible.
47
- *
48
- * {
49
- *     type: SET_INVITE_DIALOG_VISIBLE,
50
- *     visible: boolean
51
- * }
52
- */
53
-export const SET_INVITE_DIALOG_VISIBLE = 'SET_INVITE_DIALOG_VISIBLE';
54
-
55
 /**
44
 /**
56
  * The type of the action which signals an error occurred while requesting dial-
45
  * The type of the action which signals an error occurred while requesting dial-
57
  * in numbers.
46
  * in numbers.

+ 0
- 18
react/features/invite/actions.any.js Переглянути файл

11
     BEGIN_ADD_PEOPLE,
11
     BEGIN_ADD_PEOPLE,
12
     REMOVE_PENDING_INVITE_REQUESTS,
12
     REMOVE_PENDING_INVITE_REQUESTS,
13
     SET_CALLEE_INFO_VISIBLE,
13
     SET_CALLEE_INFO_VISIBLE,
14
-    SET_INVITE_DIALOG_VISIBLE,
15
     UPDATE_DIAL_IN_NUMBERS_FAILED,
14
     UPDATE_DIAL_IN_NUMBERS_FAILED,
16
     UPDATE_DIAL_IN_NUMBERS_SUCCESS
15
     UPDATE_DIAL_IN_NUMBERS_SUCCESS
17
 } from './actionTypes';
16
 } from './actionTypes';
199
     };
198
     };
200
 }
199
 }
201
 
200
 
202
-/**
203
- * Sets the visibility of the invite dialog.
204
- *
205
- * @param {boolean} visible - The visibility to set.
206
- * @returns {{
207
- *     type: SET_INVITE_DIALOG_VISIBLE,
208
- *     visible: boolean
209
- * }}
210
- */
211
-export function setAddPeopleDialogVisible(visible: boolean) {
212
-    return {
213
-        type: SET_INVITE_DIALOG_VISIBLE,
214
-        visible
215
-    };
216
-}
217
-
218
 /**
201
 /**
219
  * Sets the visibility of {@code CalleeInfo}.
202
  * Sets the visibility of {@code CalleeInfo}.
220
  *
203
  *
255
     };
238
     };
256
 }
239
 }
257
 
240
 
258
-
259
 /**
241
 /**
260
  * Removes all pending invite requests.
242
  * Removes all pending invite requests.
261
  *
243
  *

+ 3
- 2
react/features/invite/actions.native.js Переглянути файл

3
 import type { Dispatch } from 'redux';
3
 import type { Dispatch } from 'redux';
4
 
4
 
5
 import { getFeatureFlag, INVITE_ENABLED } from '../base/flags';
5
 import { getFeatureFlag, INVITE_ENABLED } from '../base/flags';
6
+import { setActiveModalId } from '../base/modal';
6
 import { beginShareRoom } from '../share-room';
7
 import { beginShareRoom } from '../share-room';
7
 
8
 
8
-import { setAddPeopleDialogVisible } from './actions.any';
9
 import { isAddPeopleEnabled, isDialOutEnabled } from './functions';
9
 import { isAddPeopleEnabled, isDialOutEnabled } from './functions';
10
+import { ADD_PEOPLE_DIALOG_VIEW_ID } from './constants';
10
 
11
 
11
 export * from './actions.any';
12
 export * from './actions.any';
12
 
13
 
23
             && (isAddPeopleEnabled(state) || isDialOutEnabled(state));
24
             && (isAddPeopleEnabled(state) || isDialOutEnabled(state));
24
 
25
 
25
         if (addPeopleEnabled) {
26
         if (addPeopleEnabled) {
26
-            return dispatch(setAddPeopleDialogVisible(true));
27
+            return dispatch(setActiveModalId(ADD_PEOPLE_DIALOG_VIEW_ID));
27
         }
28
         }
28
 
29
 
29
         return dispatch(beginShareRoom());
30
         return dispatch(beginShareRoom());

+ 73
- 98
react/features/invite/components/add-people-dialog/native/AddPeopleDialog.js Переглянути файл

5
 import {
5
 import {
6
     ActivityIndicator,
6
     ActivityIndicator,
7
     FlatList,
7
     FlatList,
8
-    KeyboardAvoidingView,
9
     Platform,
8
     Platform,
10
     SafeAreaView,
9
     SafeAreaView,
11
     TextInput,
10
     TextInput,
25
     IconSearch,
24
     IconSearch,
26
     IconShare
25
     IconShare
27
 } from '../../../../base/icons';
26
 } from '../../../../base/icons';
27
+import { JitsiModal, setActiveModalId } from '../../../../base/modal';
28
 import {
28
 import {
29
     AvatarListItem,
29
     AvatarListItem,
30
-    HeaderWithNavigation,
31
-    SlidingView,
32
     type Item
30
     type Item
33
 } from '../../../../base/react';
31
 } from '../../../../base/react';
34
 import { connect } from '../../../../base/redux';
32
 import { connect } from '../../../../base/redux';
35
 import { beginShareRoom } from '../../../../share-room';
33
 import { beginShareRoom } from '../../../../share-room';
36
 
34
 
37
-import { setAddPeopleDialogVisible } from '../../../actions.native';
35
+import { ADD_PEOPLE_DIALOG_VIEW_ID } from '../../../constants';
38
 
36
 
39
 import AbstractAddPeopleDialog, {
37
 import AbstractAddPeopleDialog, {
40
     type Props as AbstractProps,
38
     type Props as AbstractProps,
131
         this._renderItem = this._renderItem.bind(this);
129
         this._renderItem = this._renderItem.bind(this);
132
         this._renderSeparator = this._renderSeparator.bind(this);
130
         this._renderSeparator = this._renderSeparator.bind(this);
133
         this._onClearField = this._onClearField.bind(this);
131
         this._onClearField = this._onClearField.bind(this);
134
-        this._onCloseAddPeopleDialog = this._onCloseAddPeopleDialog.bind(this);
135
         this._onInvite = this._onInvite.bind(this);
132
         this._onInvite = this._onInvite.bind(this);
136
         this._onPressItem = this._onPressItem.bind(this);
133
         this._onPressItem = this._onPressItem.bind(this);
137
         this._onShareMeeting = this._onShareMeeting.bind(this);
134
         this._onShareMeeting = this._onShareMeeting.bind(this);
138
         this._onTypeQuery = this._onTypeQuery.bind(this);
135
         this._onTypeQuery = this._onTypeQuery.bind(this);
136
+        this._renderShareMeetingButton = this._renderShareMeetingButton.bind(this);
139
         this._setFieldRef = this._setFieldRef.bind(this);
137
         this._setFieldRef = this._setFieldRef.bind(this);
140
     }
138
     }
141
 
139
 
159
     render() {
157
     render() {
160
         const {
158
         const {
161
             _addPeopleEnabled,
159
             _addPeopleEnabled,
162
-            _dialOutEnabled,
163
-            _headerStyles
160
+            _dialOutEnabled
164
         } = this.props;
161
         } = this.props;
165
         const { inviteItems, selectableItems } = this.state;
162
         const { inviteItems, selectableItems } = this.state;
166
 
163
 
173
         }
170
         }
174
 
171
 
175
         return (
172
         return (
176
-            <SlidingView
177
-                onHide = { this._onCloseAddPeopleDialog }
178
-                position = 'bottom'
179
-                show = { this.props._isVisible } >
180
-                <HeaderWithNavigation
181
-                    forwardDisabled = { this._isAddDisabled() }
182
-                    forwardLabelKey = 'inviteDialog.send'
183
-                    headerLabelKey = 'inviteDialog.header'
184
-                    onPressBack = { this._onCloseAddPeopleDialog }
185
-                    onPressForward = { this._onInvite } />
186
-                <KeyboardAvoidingView
187
-                    behavior = 'padding'
188
-                    style = { styles.avoidingView }>
189
-                    <SafeAreaView style = { styles.dialogWrapper }>
190
-                        <View
191
-                            style = { styles.searchFieldWrapper }>
192
-                            <View style = { styles.searchIconWrapper }>
193
-                                { this.state.searchInprogress
194
-                                    ? <ActivityIndicator
195
-                                        color = { DARK_GREY }
196
-                                        size = 'small' />
197
-                                    : <Icon
198
-                                        src = { IconSearch }
199
-                                        style = { styles.searchIcon } />}
200
-                            </View>
201
-                            <TextInput
202
-                                autoCorrect = { false }
203
-                                autoFocus = { false }
204
-                                onBlur = { this._onFocused(false) }
205
-                                onChangeText = { this._onTypeQuery }
206
-                                onFocus = { this._onFocused(true) }
207
-                                placeholder = {
208
-                                    this.props.t(`inviteDialog.${placeholderKey}`)
209
-                                }
210
-                                ref = { this._setFieldRef }
211
-                                style = { styles.searchField }
212
-                                value = { this.state.fieldValue } />
213
-                            { this._renderClearButton() }
214
-                        </View>
215
-                        { Boolean(inviteItems.length) && <View style = { styles.invitedList }>
216
-                            <FlatList
217
-                                data = { inviteItems }
218
-                                horizontal = { true }
219
-                                keyExtractor = { this._keyExtractor }
220
-                                keyboardShouldPersistTaps = 'always'
221
-                                renderItem = { this._renderInvitedItem } />
222
-                        </View> }
223
-                        <View style = { styles.resultList }>
224
-                            <FlatList
225
-                                ItemSeparatorComponent = { this._renderSeparator }
226
-                                data = { selectableItems }
227
-                                extraData = { inviteItems }
228
-                                keyExtractor = { this._keyExtractor }
229
-                                keyboardShouldPersistTaps = 'always'
230
-                                renderItem = { this._renderItem } />
231
-                        </View>
232
-                    </SafeAreaView>
233
-                    <SafeAreaView
234
-                        style = { [
235
-                            styles.bottomBar,
236
-                            _headerStyles.headerOverlay,
237
-                            this.state.bottomPadding ? styles.extraBarPadding : null ] }>
238
-                        { this._renderShareMeetingButton() }
239
-                    </SafeAreaView>
240
-                </KeyboardAvoidingView>
241
-            </SlidingView>
173
+            <JitsiModal
174
+                footerComponent = { this._renderShareMeetingButton }
175
+                headerProps = {{
176
+                    forwardDisabled: this._isAddDisabled(),
177
+                    forwardLabelKey: 'inviteDialog.send',
178
+                    headerLabelKey: 'inviteDialog.header',
179
+                    onPressForward: this._onInvite
180
+                }}
181
+                modalId = { ADD_PEOPLE_DIALOG_VIEW_ID }>
182
+                <View
183
+                    style = { styles.searchFieldWrapper }>
184
+                    <View style = { styles.searchIconWrapper }>
185
+                        { this.state.searchInprogress
186
+                            ? <ActivityIndicator
187
+                                color = { DARK_GREY }
188
+                                size = 'small' />
189
+                            : <Icon
190
+                                src = { IconSearch }
191
+                                style = { styles.searchIcon } />}
192
+                    </View>
193
+                    <TextInput
194
+                        autoCorrect = { false }
195
+                        autoFocus = { false }
196
+                        onBlur = { this._onFocused(false) }
197
+                        onChangeText = { this._onTypeQuery }
198
+                        onFocus = { this._onFocused(true) }
199
+                        placeholder = {
200
+                            this.props.t(`inviteDialog.${placeholderKey}`)
201
+                        }
202
+                        ref = { this._setFieldRef }
203
+                        style = { styles.searchField }
204
+                        value = { this.state.fieldValue } />
205
+                    { this._renderClearButton() }
206
+                </View>
207
+                { Boolean(inviteItems.length) && <View style = { styles.invitedList }>
208
+                    <FlatList
209
+                        data = { inviteItems }
210
+                        horizontal = { true }
211
+                        keyExtractor = { this._keyExtractor }
212
+                        keyboardShouldPersistTaps = 'always'
213
+                        renderItem = { this._renderInvitedItem } />
214
+                </View> }
215
+                <View style = { styles.resultList }>
216
+                    <FlatList
217
+                        ItemSeparatorComponent = { this._renderSeparator }
218
+                        data = { selectableItems }
219
+                        extraData = { inviteItems }
220
+                        keyExtractor = { this._keyExtractor }
221
+                        keyboardShouldPersistTaps = 'always'
222
+                        renderItem = { this._renderItem } />
223
+                </View>
224
+            </JitsiModal>
242
         );
225
         );
243
     }
226
     }
244
 
227
 
311
         this._onTypeQuery('');
294
         this._onTypeQuery('');
312
     }
295
     }
313
 
296
 
314
-    _onCloseAddPeopleDialog: () => boolean
315
-
316
-    /**
317
-     * Closes the dialog.
318
-     *
319
-     * @returns {boolean}
320
-     */
321
-    _onCloseAddPeopleDialog() {
322
-        if (this.props._isVisible) {
323
-            this.props.dispatch(setAddPeopleDialogVisible(false));
324
-
325
-            return true;
326
-        }
327
-
328
-        return false;
329
-    }
330
-
331
     _onFocused: boolean => Function;
297
     _onFocused: boolean => Function;
332
 
298
 
333
     /**
299
     /**
360
                     });
326
                     });
361
                     this._showFailedInviteAlert();
327
                     this._showFailedInviteAlert();
362
                 } else {
328
                 } else {
363
-                    this._onCloseAddPeopleDialog();
329
+                    this.props.dispatch(setActiveModalId());
364
                 }
330
                 }
365
             });
331
             });
366
     }
332
     }
587
         );
553
         );
588
     }
554
     }
589
 
555
 
556
+    _renderShareMeetingButton: () => React$Element<any>;
557
+
590
     /**
558
     /**
591
      * Renders a button to share the meeting info.
559
      * Renders a button to share the meeting info.
592
      *
560
      *
596
         const { _headerStyles } = this.props;
564
         const { _headerStyles } = this.props;
597
 
565
 
598
         return (
566
         return (
599
-            <TouchableOpacity
600
-                onPress = { this._onShareMeeting }>
601
-                <Icon
602
-                    src = { IconShare }
603
-                    style = { [ _headerStyles.headerButtonText, styles.shareIcon ] } />
604
-            </TouchableOpacity>
567
+            <SafeAreaView
568
+                style = { [
569
+                    styles.bottomBar,
570
+                    _headerStyles.headerOverlay,
571
+                    this.state.bottomPadding ? styles.extraBarPadding : null
572
+                ] }>
573
+                <TouchableOpacity
574
+                    onPress = { this._onShareMeeting }>
575
+                    <Icon
576
+                        src = { IconShare }
577
+                        style = { [ _headerStyles.headerButtonText, styles.shareIcon ] } />
578
+                </TouchableOpacity>
579
+            </SafeAreaView>
605
         );
580
         );
606
     }
581
     }
607
 
582
 
647
     return {
622
     return {
648
         ..._abstractMapStateToProps(state),
623
         ..._abstractMapStateToProps(state),
649
         _headerStyles: ColorSchemeRegistry.get(state, 'Header'),
624
         _headerStyles: ColorSchemeRegistry.get(state, 'Header'),
650
-        _isVisible: state['features/invite'].inviteDialogVisible
625
+        _isVisible: state['features/base/modal'].activeModalId === ADD_PEOPLE_DIALOG_VIEW_ID
651
     };
626
     };
652
 }
627
 }
653
 
628
 

+ 1
- 13
react/features/invite/components/add-people-dialog/native/styles.js Переглянути файл

1
 // @flow
1
 // @flow
2
 
2
 
3
-import { BoxModel, ColorPalette } from '../../../../base/styles';
3
+import { BoxModel } from '../../../../base/styles';
4
 
4
 
5
 export const AVATAR_SIZE = 40;
5
 export const AVATAR_SIZE = 40;
6
 export const DARK_GREY = 'rgb(28, 32, 37)';
6
 export const DARK_GREY = 'rgb(28, 32, 37)';
19
         fontSize: 12
19
         fontSize: 12
20
     },
20
     },
21
 
21
 
22
-    avoidingView: {
23
-        flex: 1
24
-    },
25
-
26
     bottomBar: {
22
     bottomBar: {
27
         alignItems: 'center',
23
         alignItems: 'center',
28
         flexDirection: 'row',
24
         flexDirection: 'row',
50
         width: 24
46
         width: 24
51
     },
47
     },
52
 
48
 
53
-    dialogWrapper: {
54
-        alignItems: 'stretch',
55
-        backgroundColor: ColorPalette.white,
56
-        flex: 1,
57
-        flexDirection: 'column',
58
-        justifyContent: 'flex-start'
59
-    },
60
-
61
     /**
49
     /**
62
      * A special padding to avoid issues on some devices (such as Android devices with custom suggestions bar).
50
      * A special padding to avoid issues on some devices (such as Android devices with custom suggestions bar).
63
      */
51
      */

+ 7
- 0
react/features/invite/constants.js Переглянути файл

1
+// @flow
2
+
3
+/**
4
+ * Modal ID for the AddPeopleDialog modal.
5
+ */
6
+export const ADD_PEOPLE_DIALOG_VIEW_ID = 'ADD_PEOPLE_DIALOG_VIEW_ID';
1
 
7
 
2
 /**
8
 /**
3
  * Modal ID for the DialInSummary modal.
9
  * Modal ID for the DialInSummary modal.
4
  */
10
  */
5
 export const DIAL_IN_SUMMARY_VIEW_ID = 'DIAL_IN_SUMMARY_VIEW_ID';
11
 export const DIAL_IN_SUMMARY_VIEW_ID = 'DIAL_IN_SUMMARY_VIEW_ID';
12
+
6
 /**
13
 /**
7
  * The identifier of the sound to be played when the status of an outgoing call
14
  * The identifier of the sound to be played when the status of an outgoing call
8
  * is expired.
15
  * is expired.

+ 0
- 9
react/features/invite/reducer.js Переглянути файл

6
     ADD_PENDING_INVITE_REQUEST,
6
     ADD_PENDING_INVITE_REQUEST,
7
     REMOVE_PENDING_INVITE_REQUESTS,
7
     REMOVE_PENDING_INVITE_REQUESTS,
8
     SET_CALLEE_INFO_VISIBLE,
8
     SET_CALLEE_INFO_VISIBLE,
9
-    SET_INVITE_DIALOG_VISIBLE,
10
     UPDATE_DIAL_IN_NUMBERS_FAILED,
9
     UPDATE_DIAL_IN_NUMBERS_FAILED,
11
     UPDATE_DIAL_IN_NUMBERS_SUCCESS
10
     UPDATE_DIAL_IN_NUMBERS_SUCCESS
12
 } from './actionTypes';
11
 } from './actionTypes';
20
      * @type {boolean|undefined}
19
      * @type {boolean|undefined}
21
      */
20
      */
22
     calleeInfoVisible: false,
21
     calleeInfoVisible: false,
23
-    inviteDialogVisible: false,
24
     numbersEnabled: true,
22
     numbersEnabled: true,
25
     pendingInviteRequests: []
23
     pendingInviteRequests: []
26
 };
24
 };
49
             initialCalleeInfo: action.initialCalleeInfo
47
             initialCalleeInfo: action.initialCalleeInfo
50
         };
48
         };
51
 
49
 
52
-
53
-    case SET_INVITE_DIALOG_VISIBLE:
54
-        return {
55
-            ...state,
56
-            inviteDialogVisible: action.visible
57
-        };
58
-
59
     case UPDATE_DIAL_IN_NUMBERS_FAILED:
50
     case UPDATE_DIAL_IN_NUMBERS_FAILED:
60
         return {
51
         return {
61
             ...state,
52
             ...state,

Завантаження…
Відмінити
Зберегти