浏览代码

rn: add a reduced UI mode for the welcome page

The only way to render the welcome page in reduced UI mode currently is to
hangup a call from the Android ongoing notification while in PiP mode.
master
Saúl Ibarra Corretgé 6 年前
父节点
当前提交
55218de779
共有 3 个文件被更改,包括 102 次插入50 次删除
  1. 1
    0
      lang/main.json
  2. 86
    50
      react/features/welcome/components/WelcomePage.native.js
  3. 15
    0
      react/features/welcome/components/styles.js

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

@@ -791,6 +791,7 @@
791 791
         "recentList": "Recent",
792 792
         "recentListDelete": "Delete",
793 793
         "recentListEmpty": "Your recent list is currently empty. Chat with your team and you will find all your recent meetings here.",
794
+        "reducedUIText": "Welcome to __app__!",
794 795
         "roomname": "Enter room name",
795 796
         "roomnameHint": "Enter the name or URL of the room you want to join. You may make a name up, just let the people you are meeting know it so that they enter the same name.",
796 797
         "sendFeedback": "Send feedback",

+ 86
- 50
react/features/welcome/components/WelcomePage.native.js 查看文件

@@ -9,6 +9,8 @@ import {
9 9
     View
10 10
 } from 'react-native';
11 11
 
12
+import { getName } from '../../app';
13
+
12 14
 import { ColorSchemeRegistry } from '../../base/color-scheme';
13 15
 import { translate } from '../../base/i18n';
14 16
 import { Icon } from '../../base/font-icons';
@@ -23,11 +25,12 @@ import {
23 25
 import { DialInSummary } from '../../invite';
24 26
 import { SettingsView } from '../../settings';
25 27
 
28
+import { setSideBarVisible } from '../actions';
29
+
26 30
 import {
27 31
     AbstractWelcomePage,
28 32
     _mapStateToProps as _abstractMapStateToProps
29 33
 } from './AbstractWelcomePage';
30
-import { setSideBarVisible } from '../actions';
31 34
 import LocalVideoTrackUnderlay from './LocalVideoTrackUnderlay';
32 35
 import styles, { PLACEHOLDER_TEXT_COLOR } from './styles';
33 36
 import VideoSwitch from './VideoSwitch';
@@ -95,52 +98,13 @@ class WelcomePage extends AbstractWelcomePage {
95 98
      * @returns {ReactElement}
96 99
      */
97 100
     render() {
98
-        const roomnameAccLabel = 'welcomepage.accessibilityLabel.roomname';
99
-        const { _headerStyles, t } = this.props;
101
+        const { _reducedUI } = this.props;
100 102
 
101
-        return (
102
-            <LocalVideoTrackUnderlay style = { styles.welcomePage }>
103
-                <View style = { _headerStyles.page }>
104
-                    <Header style = { styles.header }>
105
-                        <TouchableOpacity onPress = { this._onShowSideBar } >
106
-                            <Icon
107
-                                name = 'menu'
108
-                                style = { _headerStyles.headerButtonIcon } />
109
-                        </TouchableOpacity>
110
-                        <VideoSwitch />
111
-                    </Header>
112
-                    <SafeAreaView style = { styles.roomContainer } >
113
-                        <View style = { styles.joinControls } >
114
-                            <TextInput
115
-                                accessibilityLabel = { t(roomnameAccLabel) }
116
-                                autoCapitalize = 'none'
117
-                                autoComplete = 'off'
118
-                                autoCorrect = { false }
119
-                                autoFocus = { false }
120
-                                onBlur = { this._onFieldBlur }
121
-                                onChangeText = { this._onRoomChange }
122
-                                onFocus = { this._onFieldFocus }
123
-                                onSubmitEditing = { this._onJoin }
124
-                                placeholder = { t('welcomepage.roomname') }
125
-                                placeholderTextColor = {
126
-                                    PLACEHOLDER_TEXT_COLOR
127
-                                }
128
-                                returnKeyType = { 'go' }
129
-                                style = { styles.textInput }
130
-                                underlineColorAndroid = 'transparent'
131
-                                value = { this.state.room } />
132
-                            {
133
-                                this._renderHintBox()
134
-                            }
135
-                        </View>
136
-                    </SafeAreaView>
137
-                    <WelcomePageLists disabled = { this.state._fieldFocused } />
138
-                    <SettingsView />
139
-                    <DialInSummary />
140
-                </View>
141
-                <WelcomePageSideBar />
142
-            </LocalVideoTrackUnderlay>
143
-        );
103
+        if (_reducedUI) {
104
+            return this._renderReducedUI();
105
+        }
106
+
107
+        return this._renderFullUI();
144 108
     }
145 109
 
146 110
     /**
@@ -272,20 +236,92 @@ class WelcomePage extends AbstractWelcomePage {
272 236
             </TouchableHighlight>
273 237
         );
274 238
     }
239
+
240
+    /**
241
+     * Renders the full welcome page.
242
+     *
243
+     * @returns {ReactElement}
244
+     */
245
+    _renderFullUI() {
246
+        const roomnameAccLabel = 'welcomepage.accessibilityLabel.roomname';
247
+        const { _headerStyles, t } = this.props;
248
+
249
+        return (
250
+            <LocalVideoTrackUnderlay style = { styles.welcomePage }>
251
+                <View style = { _headerStyles.page }>
252
+                    <Header style = { styles.header }>
253
+                        <TouchableOpacity onPress = { this._onShowSideBar } >
254
+                            <Icon
255
+                                name = 'menu'
256
+                                style = { _headerStyles.headerButtonIcon } />
257
+                        </TouchableOpacity>
258
+                        <VideoSwitch />
259
+                    </Header>
260
+                    <SafeAreaView style = { styles.roomContainer } >
261
+                        <View style = { styles.joinControls } >
262
+                            <TextInput
263
+                                accessibilityLabel = { t(roomnameAccLabel) }
264
+                                autoCapitalize = 'none'
265
+                                autoComplete = 'off'
266
+                                autoCorrect = { false }
267
+                                autoFocus = { false }
268
+                                onBlur = { this._onFieldBlur }
269
+                                onChangeText = { this._onRoomChange }
270
+                                onFocus = { this._onFieldFocus }
271
+                                onSubmitEditing = { this._onJoin }
272
+                                placeholder = { t('welcomepage.roomname') }
273
+                                placeholderTextColor = {
274
+                                    PLACEHOLDER_TEXT_COLOR
275
+                                }
276
+                                returnKeyType = { 'go' }
277
+                                style = { styles.textInput }
278
+                                underlineColorAndroid = 'transparent'
279
+                                value = { this.state.room } />
280
+                            {
281
+                                this._renderHintBox()
282
+                            }
283
+                        </View>
284
+                    </SafeAreaView>
285
+                    <WelcomePageLists disabled = { this.state._fieldFocused } />
286
+                    <SettingsView />
287
+                    <DialInSummary />
288
+                </View>
289
+                <WelcomePageSideBar />
290
+            </LocalVideoTrackUnderlay>
291
+        );
292
+    }
293
+
294
+    /**
295
+     * Renders a "reduced" version of the welcome page.
296
+     *
297
+     * @returns {ReactElement}
298
+     */
299
+    _renderReducedUI() {
300
+        const { t } = this.props;
301
+
302
+        return (
303
+            <View style = { styles.reducedUIContainer }>
304
+                <Text style = { styles.reducedUIText }>
305
+                    { t('welcomepage.reducedUIText', { app: getName() }) }
306
+                </Text>
307
+            </View>
308
+        );
309
+    }
275 310
 }
276 311
 
277 312
 /**
278 313
  * Maps part of the Redux state to the props of this component.
279 314
  *
280 315
  * @param {Object} state - The Redux state.
281
- * @returns {{
282
- *     _headerStyles: Object
283
- * }}
316
+ * @returns {Object}
284 317
  */
285 318
 function _mapStateToProps(state) {
319
+    const { reducedUI } = state['features/base/responsive-ui'];
320
+
286 321
     return {
287 322
         ..._abstractMapStateToProps(state),
288
-        _headerStyles: ColorSchemeRegistry.get(state, 'Header')
323
+        _headerStyles: ColorSchemeRegistry.get(state, 'Header'),
324
+        _reducedUI: reducedUI
289 325
     };
290 326
 }
291 327
 

+ 15
- 0
react/features/welcome/components/styles.js 查看文件

@@ -163,6 +163,21 @@ export default createStyleSheet({
163 163
         flexDirection: 'column'
164 164
     },
165 165
 
166
+    /**
167
+     * The styles for reduced UI mode.
168
+     */
169
+    reducedUIContainer: {
170
+        alignItems: 'center',
171
+        backgroundColor: ColorPalette.blue,
172
+        flex: 1,
173
+        justifyContent: 'center'
174
+    },
175
+
176
+    reducedUIText: {
177
+        color: TEXT_COLOR,
178
+        fontSize: 12
179
+    },
180
+
166 181
     /**
167 182
      * Container for room name input box and 'join' button.
168 183
      */

正在加载...
取消
保存