Explorar el Código

Finally! Let there be... responsive-ui!

We started on the way to responsive UI and its design with aspect ratio
and keeping the filmstrip on the short side of the app's visible
rectangle.

Shortly, we're going to introduce reduced UI for Picture-in-Picture. And
that's where we'll need another dimensions-based detector akin to the
aspect ratio detector.

While the AspectRatioDetector, the up-and-coming ReducedUIDetector, and
their base DimensionsDetector are definitely separate abstractions and
implementations not mixed for the purposes of easy extensibility and
maintenance, the three of them are our building blocks on top of which
we'll build our responsive UI.
j8
Lyubo Marinov hace 7 años
padre
commit
c9d8b5c827

+ 1
- 1
react/features/app-settings/components/AbstractAppSettings.js Ver fichero

173
     const _profile = getProfile(state);
173
     const _profile = getProfile(state);
174
 
174
 
175
     return {
175
     return {
176
-        _aspectRatio: state['features/base/aspect-ratio'].aspectRatio,
176
+        _aspectRatio: state['features/base/responsive-ui'].aspectRatio,
177
         _profile,
177
         _profile,
178
         _serverURL,
178
         _serverURL,
179
         _visible: state['features/app-settings'].visible
179
         _visible: state['features/app-settings'].visible

+ 1
- 1
react/features/app-settings/components/AppSettings.native.js Ver fichero

12
 } from 'react-native';
12
 } from 'react-native';
13
 import { connect } from 'react-redux';
13
 import { connect } from 'react-redux';
14
 
14
 
15
-import { ASPECT_RATIO_NARROW } from '../../base/aspect-ratio';
16
 import { translate } from '../../base/i18n';
15
 import { translate } from '../../base/i18n';
17
 import { getSafetyOffset, isIPad } from '../../base/react';
16
 import { getSafetyOffset, isIPad } from '../../base/react';
17
+import { ASPECT_RATIO_NARROW } from '../../base/responsive-ui';
18
 
18
 
19
 import { _mapStateToProps, AbstractAppSettings } from './AbstractAppSettings';
19
 import { _mapStateToProps, AbstractAppSettings } from './AbstractAppSettings';
20
 import { hideAppSettings } from '../actions';
20
 import { hideAppSettings } from '../actions';

+ 2
- 2
react/features/app-settings/components/FormRow.native.js Ver fichero

4
 import { Text, View } from 'react-native';
4
 import { Text, View } from 'react-native';
5
 import { connect } from 'react-redux';
5
 import { connect } from 'react-redux';
6
 
6
 
7
-import { ASPECT_RATIO_WIDE } from '../../base/aspect-ratio';
8
 import { translate } from '../../base/i18n';
7
 import { translate } from '../../base/i18n';
9
 import { getSafetyOffset } from '../../base/react';
8
 import { getSafetyOffset } from '../../base/react';
9
+import { ASPECT_RATIO_WIDE } from '../../base/responsive-ui';
10
 
10
 
11
 import styles, { ANDROID_UNDERLINE_COLOR, CONTAINER_PADDING } from './styles';
11
 import styles, { ANDROID_UNDERLINE_COLOR, CONTAINER_PADDING } from './styles';
12
 
12
 
162
  */
162
  */
163
 export function _mapStateToProps(state: Object) {
163
 export function _mapStateToProps(state: Object) {
164
     return {
164
     return {
165
-        _aspectRatio: state['features/base/aspect-ratio'].aspectRatio
165
+        _aspectRatio: state['features/base/responsive-ui'].aspectRatio
166
     };
166
     };
167
 }
167
 }
168
 
168
 

+ 2
- 2
react/features/app-settings/components/FormSectionHeader.native.js Ver fichero

4
 import { Text, View } from 'react-native';
4
 import { Text, View } from 'react-native';
5
 import { connect } from 'react-redux';
5
 import { connect } from 'react-redux';
6
 
6
 
7
-import { ASPECT_RATIO_WIDE } from '../../base/aspect-ratio';
8
 import { translate } from '../../base/i18n';
7
 import { translate } from '../../base/i18n';
9
 import { getSafetyOffset } from '../../base/react';
8
 import { getSafetyOffset } from '../../base/react';
9
+import { ASPECT_RATIO_WIDE } from '../../base/responsive-ui';
10
 
10
 
11
 import styles, { CONTAINER_PADDING } from './styles';
11
 import styles, { CONTAINER_PADDING } from './styles';
12
 
12
 
110
  */
110
  */
111
 export function _mapStateToProps(state: Object) {
111
 export function _mapStateToProps(state: Object) {
112
     return {
112
     return {
113
-        _aspectRatio: state['features/base/aspect-ratio'].aspectRatio
113
+        _aspectRatio: state['features/base/responsive-ui'].aspectRatio
114
     };
114
     };
115
 }
115
 }
116
 
116
 

+ 1
- 1
react/features/app/components/App.native.js Ver fichero

6
 
6
 
7
 import '../../analytics';
7
 import '../../analytics';
8
 import '../../authentication';
8
 import '../../authentication';
9
-import { AspectRatioDetector } from '../../base/aspect-ratio';
10
 import { Platform } from '../../base/react';
9
 import { Platform } from '../../base/react';
10
+import { AspectRatioDetector } from '../../base/responsive-ui';
11
 import '../../mobile/audio-mode';
11
 import '../../mobile/audio-mode';
12
 import '../../mobile/background';
12
 import '../../mobile/background';
13
 import '../../mobile/callkit';
13
 import '../../mobile/callkit';

+ 0
- 1
react/features/base/dimensions-detector/components/index.js Ver fichero

1
-export { default as DimensionsDetector } from './DimensionsDetector';

+ 0
- 1
react/features/base/dimensions-detector/index.js Ver fichero

1
-export * from './components';

react/features/base/aspect-ratio/actionTypes.js → react/features/base/responsive-ui/actionTypes.js Ver fichero


react/features/base/aspect-ratio/actions.js → react/features/base/responsive-ui/actions.js Ver fichero

25
                 = width < height ? ASPECT_RATIO_NARROW : ASPECT_RATIO_WIDE;
25
                 = width < height ? ASPECT_RATIO_NARROW : ASPECT_RATIO_WIDE;
26
 
26
 
27
             if (aspectRatio
27
             if (aspectRatio
28
-                    !== getState()['features/base/aspect-ratio'].aspectRatio) {
28
+                    !== getState()['features/base/responsive-ui'].aspectRatio) {
29
                 return dispatch({
29
                 return dispatch({
30
                     type: SET_ASPECT_RATIO,
30
                     type: SET_ASPECT_RATIO,
31
                     aspectRatio
31
                     aspectRatio

react/features/base/aspect-ratio/components/AspectRatioAware.js → react/features/base/responsive-ui/components/AspectRatioAware.js Ver fichero

67
  * @param {Object} state - The whole redux state.
67
  * @param {Object} state - The whole redux state.
68
  * @private
68
  * @private
69
  * @returns {{
69
  * @returns {{
70
- *      aspectRatio: Symbol
70
+ *     aspectRatio: Symbol
71
  * }}
71
  * }}
72
  */
72
  */
73
 function _mapStateToProps(state) {
73
 function _mapStateToProps(state) {
74
     return {
74
     return {
75
-        aspectRatio: state['features/base/aspect-ratio'].aspectRatio
75
+        aspectRatio: state['features/base/responsive-ui'].aspectRatio
76
     };
76
     };
77
 }
77
 }

react/features/base/aspect-ratio/components/AspectRatioDetector.native.js → react/features/base/responsive-ui/components/AspectRatioDetector.js Ver fichero

3
 import React, { Component } from 'react';
3
 import React, { Component } from 'react';
4
 import { connect } from 'react-redux';
4
 import { connect } from 'react-redux';
5
 
5
 
6
-import { DimensionsDetector } from '../../dimensions-detector';
7
-
8
 import { setAspectRatio } from '../actions';
6
 import { setAspectRatio } from '../actions';
7
+import DimensionsDetector from './DimensionsDetector';
9
 
8
 
10
 /**
9
 /**
11
  * AspectRatioDetector component's property types.
10
  * AspectRatioDetector component's property types.

react/features/base/dimensions-detector/components/DimensionsDetector.native.js → react/features/base/responsive-ui/components/DimensionsDetector.native.js Ver fichero


+ 0
- 0
react/features/base/responsive-ui/components/DimensionsDetector.web.js Ver fichero


react/features/base/aspect-ratio/components/index.js → react/features/base/responsive-ui/components/index.js Ver fichero

1
 export * from './AspectRatioAware';
1
 export * from './AspectRatioAware';
2
 export { default as AspectRatioDetector } from './AspectRatioDetector';
2
 export { default as AspectRatioDetector } from './AspectRatioDetector';
3
+export { default as DimensionsDetector } from './DimensionsDetector';

react/features/base/dimensions-detector/components/styles.js → react/features/base/responsive-ui/components/styles.js Ver fichero

1
 import { createStyleSheet } from '../../styles';
1
 import { createStyleSheet } from '../../styles';
2
 
2
 
3
 /**
3
 /**
4
- * The styles of the feature base/aspect-ratio.
4
+ * The styles of the feature base/responsive-ui.
5
  */
5
  */
6
 export default createStyleSheet({
6
 export default createStyleSheet({
7
     /**
7
     /**

react/features/base/aspect-ratio/constants.js → react/features/base/responsive-ui/constants.js Ver fichero


react/features/base/aspect-ratio/index.js → react/features/base/responsive-ui/index.js Ver fichero


react/features/base/aspect-ratio/reducer.js → react/features/base/responsive-ui/reducer.js Ver fichero

4
 import { ASPECT_RATIO_NARROW } from './constants';
4
 import { ASPECT_RATIO_NARROW } from './constants';
5
 
5
 
6
 /**
6
 /**
7
- * The initial redux state of the feature base/aspect-ratio.
7
+ * The initial redux state of the feature base/responsive-ui.
8
  */
8
  */
9
 const _INITIAL_STATE = {
9
 const _INITIAL_STATE = {
10
     aspectRatio: ASPECT_RATIO_NARROW
10
     aspectRatio: ASPECT_RATIO_NARROW
11
 };
11
 };
12
 
12
 
13
 ReducerRegistry.register(
13
 ReducerRegistry.register(
14
-    'features/base/aspect-ratio',
14
+    'features/base/responsive-ui',
15
     (state = _INITIAL_STATE, action) => {
15
     (state = _INITIAL_STATE, action) => {
16
         switch (action.type) {
16
         switch (action.type) {
17
         case SET_ASPECT_RATIO:
17
         case SET_ASPECT_RATIO:

+ 3
- 3
react/features/filmstrip/components/Filmstrip.native.js Ver fichero

5
 import { ScrollView } from 'react-native';
5
 import { ScrollView } from 'react-native';
6
 import { connect } from 'react-redux';
6
 import { connect } from 'react-redux';
7
 
7
 
8
+import { Container } from '../../base/react';
8
 import {
9
 import {
9
     isNarrowAspectRatio,
10
     isNarrowAspectRatio,
10
     makeAspectRatioAware
11
     makeAspectRatioAware
11
-} from '../../base/aspect-ratio';
12
-import { Container } from '../../base/react';
12
+} from '../../base/responsive-ui';
13
 
13
 
14
-import Thumbnail from './Thumbnail';
15
 import { styles } from './_';
14
 import { styles } from './_';
15
+import Thumbnail from './Thumbnail';
16
 
16
 
17
 /**
17
 /**
18
  * Implements a React {@link Component} which represents the filmstrip on
18
  * Implements a React {@link Component} which represents the filmstrip on

+ 4
- 4
react/features/toolbox/components/Toolbox.native.js Ver fichero

9
     createToolbarEvent,
9
     createToolbarEvent,
10
     sendAnalytics
10
     sendAnalytics
11
 } from '../../analytics';
11
 } from '../../analytics';
12
-import {
13
-    isNarrowAspectRatio,
14
-    makeAspectRatioAware
15
-} from '../../base/aspect-ratio';
16
 import { toggleAudioOnly } from '../../base/conference';
12
 import { toggleAudioOnly } from '../../base/conference';
17
 import {
13
 import {
18
     MEDIA_TYPE,
14
     MEDIA_TYPE,
22
     VIDEO_MUTISM_AUTHORITY
18
     VIDEO_MUTISM_AUTHORITY
23
 } from '../../base/media';
19
 } from '../../base/media';
24
 import { Container } from '../../base/react';
20
 import { Container } from '../../base/react';
21
+import {
22
+    isNarrowAspectRatio,
23
+    makeAspectRatioAware
24
+} from '../../base/responsive-ui';
25
 import { ColorPalette } from '../../base/styles';
25
 import { ColorPalette } from '../../base/styles';
26
 import { beginRoomLockRequest } from '../../room-lock';
26
 import { beginRoomLockRequest } from '../../room-lock';
27
 import { beginShareRoom } from '../../share-room';
27
 import { beginShareRoom } from '../../share-room';

Loading…
Cancelar
Guardar