浏览代码

[RN] Make feature dialogs branded: authentication

master
Bettenbuk Zoltan 7 年前
父节点
当前提交
9645de33bc

+ 2
- 1
lang/main.json 查看文件

319
         "alreadySharedVideoMsg": "Another member is already sharing a video. This conference allows only one shared video at a time.",
319
         "alreadySharedVideoMsg": "Another member is already sharing a video. This conference allows only one shared video at a time.",
320
         "alreadySharedVideoTitle": "Only one shared video is allowed at a time",
320
         "alreadySharedVideoTitle": "Only one shared video is allowed at a time",
321
         "WaitingForHost": "Waiting for the host ...",
321
         "WaitingForHost": "Waiting for the host ...",
322
-        "WaitForHostMsg": "The conference <b>__room__ </b> has not yet started. If you are the host then please authenticate. Otherwise, please wait for the host to arrive.",
322
+        "WaitForHostMsg": "The conference <b>__room__</b> has not yet started. If you are the host then please authenticate. Otherwise, please wait for the host to arrive.",
323
+        "WaitForHostMsgWOk": "The conference <b>__room__</b> has not yet started. If you are the host then please press Ok to authenticate. Otherwise, please wait for the host to arrive.",
323
         "IamHost": "I am the host",
324
         "IamHost": "I am the host",
324
         "Cancel": "Cancel",
325
         "Cancel": "Cancel",
325
         "Submit": "Submit",
326
         "Submit": "Submit",

+ 30
- 16
react/features/authentication/components/LoginDialog.native.js 查看文件

5
 import { connect as reduxConnect } from 'react-redux';
5
 import { connect as reduxConnect } from 'react-redux';
6
 
6
 
7
 import { connect, toJid } from '../../base/connection';
7
 import { connect, toJid } from '../../base/connection';
8
-import { Dialog } from '../../base/dialog';
8
+import {
9
+    CustomSubmitDialog,
10
+    FIELD_UNDERLINE,
11
+    PLACEHOLDER_COLOR,
12
+    inputDialog as inputDialogStyle
13
+} from '../../base/dialog';
9
 import { translate } from '../../base/i18n';
14
 import { translate } from '../../base/i18n';
10
 import { JitsiConnectionErrors } from '../../base/lib-jitsi-meet';
15
 import { JitsiConnectionErrors } from '../../base/lib-jitsi-meet';
11
 
16
 
162
             }
167
             }
163
         }
168
         }
164
 
169
 
170
+        const showMessage = messageKey || connecting;
171
+        const message = messageKey
172
+            ? t(messageKey, messageOptions)
173
+            : connecting
174
+                ? t('connection.CONNECTING')
175
+                : '';
176
+
165
         return (
177
         return (
166
-            <Dialog
178
+            <CustomSubmitDialog
167
                 okDisabled = { connecting }
179
                 okDisabled = { connecting }
168
                 onCancel = { this._onCancel }
180
                 onCancel = { this._onCancel }
169
-                onSubmit = { this._onLogin }
170
-                titleKey = 'dialog.passwordRequired'>
181
+                onSubmit = { this._onLogin }>
171
                 <View style = { styles.loginDialog }>
182
                 <View style = { styles.loginDialog }>
172
                     <TextInput
183
                     <TextInput
173
                         autoCapitalize = { 'none' }
184
                         autoCapitalize = { 'none' }
174
                         autoCorrect = { false }
185
                         autoCorrect = { false }
175
                         onChangeText = { this._onUsernameChange }
186
                         onChangeText = { this._onUsernameChange }
176
                         placeholder = { 'user@domain.com' }
187
                         placeholder = { 'user@domain.com' }
177
-                        style = { styles.dialogTextInput }
188
+                        placeholderTextColor = { PLACEHOLDER_COLOR }
189
+                        style = { inputDialogStyle.field }
190
+                        underlineColorAndroid = { FIELD_UNDERLINE }
178
                         value = { this.state.username } />
191
                         value = { this.state.username } />
179
                     <TextInput
192
                     <TextInput
180
                         onChangeText = { this._onPasswordChange }
193
                         onChangeText = { this._onPasswordChange }
181
                         placeholder = { t('dialog.userPassword') }
194
                         placeholder = { t('dialog.userPassword') }
195
+                        placeholderTextColor = { PLACEHOLDER_COLOR }
182
                         secureTextEntry = { true }
196
                         secureTextEntry = { true }
183
-                        style = { styles.dialogTextInput }
197
+                        style = { [
198
+                            inputDialogStyle.field,
199
+                            inputDialogStyle.bottomField
200
+                        ] }
201
+                        underlineColorAndroid = { FIELD_UNDERLINE }
184
                         value = { this.state.password } />
202
                         value = { this.state.password } />
185
-                    <Text style = { styles.dialogText }>
186
-                        {
187
-                            messageKey
188
-                                ? t(messageKey, messageOptions)
189
-                                : connecting
190
-                                    ? t('connection.CONNECTING')
191
-                                    : ''
192
-                        }
193
-                    </Text>
203
+                    { showMessage && (
204
+                        <Text style = { styles.dialogText }>
205
+                            { message }
206
+                        </Text>
207
+                    ) }
194
                 </View>
208
                 </View>
195
-            </Dialog>
209
+            </CustomSubmitDialog>
196
         );
210
         );
197
     }
211
     }
198
 
212
 

+ 9
- 67
react/features/authentication/components/WaitForOwnerDialog.native.js 查看文件

1
 // @flow
1
 // @flow
2
 
2
 
3
 import React, { Component } from 'react';
3
 import React, { Component } from 'react';
4
-import { Text } from 'react-native';
5
 import { connect } from 'react-redux';
4
 import { connect } from 'react-redux';
6
 
5
 
7
-import { Dialog } from '../../base/dialog';
6
+import { ConfirmDialog } from '../../base/dialog';
8
 import { translate } from '../../base/i18n';
7
 import { translate } from '../../base/i18n';
9
 
8
 
10
 import { cancelWaitForOwner, _openLoginDialog } from '../actions';
9
 import { cancelWaitForOwner, _openLoginDialog } from '../actions';
11
-import styles from './styles';
12
 
10
 
13
 /**
11
 /**
14
  * The type of the React {@code Component} props of {@link WaitForOwnerDialog}.
12
  * The type of the React {@code Component} props of {@link WaitForOwnerDialog}.
60
      */
58
      */
61
     render() {
59
     render() {
62
         const {
60
         const {
63
-            _room: room,
64
-            t
61
+            _room: room
65
         } = this.props;
62
         } = this.props;
66
 
63
 
67
         return (
64
         return (
68
-            <Dialog
69
-                okTitleKey = { 'dialog.IamHost' }
70
-                onCancel = { this._onCancel }
71
-                onSubmit = { this._onLogin }
72
-                titleKey = 'dialog.WaitingForHost'>
73
-                <Text style = { styles.waitForOwnerDialog }>
65
+            <ConfirmDialog
66
+                contentKey = {
74
                     {
67
                     {
75
-                        this._renderHTML(t('dialog.WaitForHostMsg', { room }))
68
+                        key: 'dialog.WaitForHostMsgWOk',
69
+                        params: { room }
76
                     }
70
                     }
77
-                </Text>
78
-            </Dialog>
71
+                }
72
+                onCancel = { this._onCancel }
73
+                onSubmit = { this._onLogin } />
79
         );
74
         );
80
     }
75
     }
81
 
76
 
102
     _onLogin() {
97
     _onLogin() {
103
         this.props.dispatch(_openLoginDialog());
98
         this.props.dispatch(_openLoginDialog());
104
     }
99
     }
105
-
106
-    /**
107
-     * Renders a specific {@code string} which may contain HTML.
108
-     *
109
-     * @param {string|undefined} html - The {@code string} which may
110
-     * contain HTML to render.
111
-     * @returns {ReactElement[]|string}
112
-     */
113
-    _renderHTML(html: ?string) {
114
-        if (typeof html === 'string') {
115
-            // At the time of this writing, the specified HTML contains a couple
116
-            // of spaces one after the other. They do not cause a visible
117
-            // problem on Web, because the specified HTML is rendered as, well,
118
-            // HTML. However, we're not rendering HTML here.
119
-
120
-            // eslint-disable-next-line no-param-reassign
121
-            html = html.replace(/\s{2,}/gi, ' ');
122
-
123
-            // Render text in <b>text</b> in bold.
124
-            const opening = /<\s*b\s*>/gi;
125
-            const closing = /<\s*\/\s*b\s*>/gi;
126
-            let o;
127
-            let c;
128
-            let prevClosingLastIndex = 0;
129
-            const r = [];
130
-
131
-            // eslint-disable-next-line no-cond-assign
132
-            while (o = opening.exec(html)) {
133
-                closing.lastIndex = opening.lastIndex;
134
-
135
-                // eslint-disable-next-line no-cond-assign
136
-                if (c = closing.exec(html)) {
137
-                    r.push(html.substring(prevClosingLastIndex, o.index));
138
-                    r.push(
139
-                        <Text style = { styles.boldDialogText }>
140
-                            { html.substring(opening.lastIndex, c.index) }
141
-                        </Text>);
142
-                    opening.lastIndex
143
-                        = prevClosingLastIndex
144
-                        = closing.lastIndex;
145
-                } else {
146
-                    break;
147
-                }
148
-            }
149
-            if (prevClosingLastIndex < html.length) {
150
-                r.push(html.substring(prevClosingLastIndex));
151
-            }
152
-
153
-            return r;
154
-        }
155
-
156
-        return html;
157
-    }
158
 }
100
 }
159
 
101
 
160
 /**
102
 /**

+ 5
- 21
react/features/authentication/components/styles.js 查看文件

1
-import { BoxModel, createStyleSheet } from '../../base/styles';
1
+import { BoxModel, ColorPalette, createStyleSheet } from '../../base/styles';
2
 
2
 
3
 /**
3
 /**
4
  * The style common to {@code LoginDialog} and {@code WaitForOwnerDialog}.
4
  * The style common to {@code LoginDialog} and {@code WaitForOwnerDialog}.
13
  * {@code WaitForOwnerDialog}.
13
  * {@code WaitForOwnerDialog}.
14
  */
14
  */
15
 const text = {
15
 const text = {
16
+    color: ColorPalette.white
16
 };
17
 };
17
 
18
 
18
 /**
19
 /**
19
  * The styles of the authentication feature.
20
  * The styles of the authentication feature.
20
  */
21
  */
21
 export default createStyleSheet({
22
 export default createStyleSheet({
22
-    /**
23
-     * The style of bold {@code Text} rendered by the {@code Dialog}s of the
24
-     * feature authentication.
25
-     */
26
-    boldDialogText: {
27
-        ...text,
28
-        fontWeight: 'bold'
29
-    },
30
 
23
 
31
     /**
24
     /**
32
      * The style of {@code Text} rendered by the {@code Dialog}s of the
25
      * The style of {@code Text} rendered by the {@code Dialog}s of the
33
      * feature authentication.
26
      * feature authentication.
34
      */
27
      */
35
     dialogText: {
28
     dialogText: {
36
-        ...text
37
-    },
38
-
39
-    /**
40
-     * The style of {@code TextInput} rendered by the {@code Dialog}s of the
41
-     * feature authentication.
42
-     */
43
-    dialogTextInput: {
44
-        // XXX Matches react-native-prompt's dialogInput because base/dialog's
45
-        // Dialog is implemented using react-native-prompt.
46
-        fontSize: 18,
47
-        height: 50
29
+        ...text,
30
+        margin: BoxModel.margin,
31
+        marginTop: BoxModel.margin * 2
48
     },
32
     },
49
 
33
 
50
     /**
34
     /**

正在加载...
取消
保存