소스 검색

ref: AddPeopleDialog to JitsiModal

j8
Bettenbuk Zoltan 5 년 전
부모
커밋
0f4369a9a9

+ 0
- 11
react/features/invite/actionTypes.js 파일 보기

@@ -41,17 +41,6 @@ export const REMOVE_PENDING_INVITE_REQUESTS
41 41
  */
42 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 45
  * The type of the action which signals an error occurred while requesting dial-
57 46
  * in numbers.

+ 0
- 18
react/features/invite/actions.any.js 파일 보기

@@ -11,7 +11,6 @@ import {
11 11
     BEGIN_ADD_PEOPLE,
12 12
     REMOVE_PENDING_INVITE_REQUESTS,
13 13
     SET_CALLEE_INFO_VISIBLE,
14
-    SET_INVITE_DIALOG_VISIBLE,
15 14
     UPDATE_DIAL_IN_NUMBERS_FAILED,
16 15
     UPDATE_DIAL_IN_NUMBERS_SUCCESS
17 16
 } from './actionTypes';
@@ -199,22 +198,6 @@ export function updateDialInNumbers() {
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 202
  * Sets the visibility of {@code CalleeInfo}.
220 203
  *
@@ -255,7 +238,6 @@ export function addPendingInviteRequest(
255 238
     };
256 239
 }
257 240
 
258
-
259 241
 /**
260 242
  * Removes all pending invite requests.
261 243
  *

+ 3
- 2
react/features/invite/actions.native.js 파일 보기

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

+ 73
- 98
react/features/invite/components/add-people-dialog/native/AddPeopleDialog.js 파일 보기

@@ -5,7 +5,6 @@ import React from 'react';
5 5
 import {
6 6
     ActivityIndicator,
7 7
     FlatList,
8
-    KeyboardAvoidingView,
9 8
     Platform,
10 9
     SafeAreaView,
11 10
     TextInput,
@@ -25,16 +24,15 @@ import {
25 24
     IconSearch,
26 25
     IconShare
27 26
 } from '../../../../base/icons';
27
+import { JitsiModal, setActiveModalId } from '../../../../base/modal';
28 28
 import {
29 29
     AvatarListItem,
30
-    HeaderWithNavigation,
31
-    SlidingView,
32 30
     type Item
33 31
 } from '../../../../base/react';
34 32
 import { connect } from '../../../../base/redux';
35 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 37
 import AbstractAddPeopleDialog, {
40 38
     type Props as AbstractProps,
@@ -131,11 +129,11 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
131 129
         this._renderItem = this._renderItem.bind(this);
132 130
         this._renderSeparator = this._renderSeparator.bind(this);
133 131
         this._onClearField = this._onClearField.bind(this);
134
-        this._onCloseAddPeopleDialog = this._onCloseAddPeopleDialog.bind(this);
135 132
         this._onInvite = this._onInvite.bind(this);
136 133
         this._onPressItem = this._onPressItem.bind(this);
137 134
         this._onShareMeeting = this._onShareMeeting.bind(this);
138 135
         this._onTypeQuery = this._onTypeQuery.bind(this);
136
+        this._renderShareMeetingButton = this._renderShareMeetingButton.bind(this);
139 137
         this._setFieldRef = this._setFieldRef.bind(this);
140 138
     }
141 139
 
@@ -159,8 +157,7 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
159 157
     render() {
160 158
         const {
161 159
             _addPeopleEnabled,
162
-            _dialOutEnabled,
163
-            _headerStyles
160
+            _dialOutEnabled
164 161
         } = this.props;
165 162
         const { inviteItems, selectableItems } = this.state;
166 163
 
@@ -173,72 +170,58 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
173 170
         }
174 171
 
175 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,23 +294,6 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
311 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 297
     _onFocused: boolean => Function;
332 298
 
333 299
     /**
@@ -360,7 +326,7 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
360 326
                     });
361 327
                     this._showFailedInviteAlert();
362 328
                 } else {
363
-                    this._onCloseAddPeopleDialog();
329
+                    this.props.dispatch(setActiveModalId());
364 330
                 }
365 331
             });
366 332
     }
@@ -587,6 +553,8 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
587 553
         );
588 554
     }
589 555
 
556
+    _renderShareMeetingButton: () => React$Element<any>;
557
+
590 558
     /**
591 559
      * Renders a button to share the meeting info.
592 560
      *
@@ -596,12 +564,19 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
596 564
         const { _headerStyles } = this.props;
597 565
 
598 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,7 +622,7 @@ function _mapStateToProps(state: Object) {
647 622
     return {
648 623
         ..._abstractMapStateToProps(state),
649 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,6 +1,6 @@
1 1
 // @flow
2 2
 
3
-import { BoxModel, ColorPalette } from '../../../../base/styles';
3
+import { BoxModel } from '../../../../base/styles';
4 4
 
5 5
 export const AVATAR_SIZE = 40;
6 6
 export const DARK_GREY = 'rgb(28, 32, 37)';
@@ -19,10 +19,6 @@ export default {
19 19
         fontSize: 12
20 20
     },
21 21
 
22
-    avoidingView: {
23
-        flex: 1
24
-    },
25
-
26 22
     bottomBar: {
27 23
         alignItems: 'center',
28 24
         flexDirection: 'row',
@@ -50,14 +46,6 @@ export default {
50 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 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,8 +1,15 @@
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 9
  * Modal ID for the DialInSummary modal.
4 10
  */
5 11
 export const DIAL_IN_SUMMARY_VIEW_ID = 'DIAL_IN_SUMMARY_VIEW_ID';
12
+
6 13
 /**
7 14
  * The identifier of the sound to be played when the status of an outgoing call
8 15
  * is expired.

+ 0
- 9
react/features/invite/reducer.js 파일 보기

@@ -6,7 +6,6 @@ import {
6 6
     ADD_PENDING_INVITE_REQUEST,
7 7
     REMOVE_PENDING_INVITE_REQUESTS,
8 8
     SET_CALLEE_INFO_VISIBLE,
9
-    SET_INVITE_DIALOG_VISIBLE,
10 9
     UPDATE_DIAL_IN_NUMBERS_FAILED,
11 10
     UPDATE_DIAL_IN_NUMBERS_SUCCESS
12 11
 } from './actionTypes';
@@ -20,7 +19,6 @@ const DEFAULT_STATE = {
20 19
      * @type {boolean|undefined}
21 20
      */
22 21
     calleeInfoVisible: false,
23
-    inviteDialogVisible: false,
24 22
     numbersEnabled: true,
25 23
     pendingInviteRequests: []
26 24
 };
@@ -49,13 +47,6 @@ ReducerRegistry.register('features/invite', (state = DEFAULT_STATE, action) => {
49 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 50
     case UPDATE_DIAL_IN_NUMBERS_FAILED:
60 51
         return {
61 52
             ...state,

Loading…
취소
저장