浏览代码

Hyperlinks to legalese such as Privacy Policy and Terms of Service

master
Lyubomir Marinov 8 年前
父节点
当前提交
1f457dfca5

+ 87
- 0
react/features/base/react/components/Link.native.js 查看文件

@@ -0,0 +1,87 @@
1
+import React, { Component } from 'react';
2
+import { Linking, Text } from 'react-native';
3
+
4
+/**
5
+ * Implements a (hyper)link to a URL in the fashion of the HTML anchor element
6
+ * and its href attribute.
7
+ */
8
+export class Link extends Component {
9
+    /**
10
+     * Initializes a new Link instance.
11
+     *
12
+     * @param {Object} props - Component properties.
13
+     */
14
+    constructor(props) {
15
+        super(props);
16
+
17
+        // Bind event handlers so they are only bound once for every instance.
18
+        this._onPress = this._onPress.bind(this);
19
+    }
20
+
21
+    /**
22
+     * Implements React's {@link Component#render()}.
23
+     *
24
+     * @inheritdoc
25
+     * @returns {ReactElement}
26
+     */
27
+    render() {
28
+        return (
29
+            <Text
30
+                onPress = { this._onPress }
31
+                style = { this.props.style }>
32
+                {
33
+                    this.props.children
34
+                }
35
+            </Text>
36
+        );
37
+    }
38
+
39
+    /**
40
+     * Notifies this instance that Linking failed to open the associated URL.
41
+     *
42
+     * @param {any} reason - The rejection reason.
43
+     * @private
44
+     * @returns {void}
45
+     */
46
+    _onLinkingOpenURLRejected(reason) {
47
+        const onRejected = this.props.onLinkingOpenURLRejected;
48
+
49
+        onRejected && onRejected(reason);
50
+    }
51
+
52
+    /**
53
+     * Handles press on this Link. Opens the URL associated with this Link.
54
+     *
55
+     * @private
56
+     * @returns {void}
57
+     */
58
+    _onPress() {
59
+        Linking.openURL(this.props.url)
60
+            .catch(reason => this._onLinkingOpenURLRejected(reason));
61
+    }
62
+}
63
+
64
+/**
65
+ * Link component's property types.
66
+ */
67
+Link.propTypes = {
68
+    /**
69
+     * The children to be displayed within this Link.
70
+     */
71
+    children: React.PropTypes.node,
72
+
73
+    /**
74
+     * Notifies that this Link failed to open the URL associated with it.
75
+     */
76
+    onLinkingOpenURLRejected: React.PropTypes.function,
77
+
78
+    /**
79
+     * The CSS style to be applied to this Link for the purposes of display.
80
+     */
81
+    style: React.PropTypes.object,
82
+
83
+    /**
84
+     * The URL to be opened when this Link is clicked/pressed.
85
+     */
86
+    url: React.PropTypes.string
87
+};

+ 1
- 0
react/features/base/react/components/index.js 查看文件

@@ -1 +1,2 @@
1 1
 export * from './Container';
2
+export * from './Link';

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

@@ -0,0 +1,15 @@
1
+/**
2
+ * The application's default properties related to the CSS box model such as
3
+ * margins, borders, padding.
4
+ */
5
+export const BoxModel = {
6
+    /**
7
+     * The application's default margin when non-zero margin is necessary.
8
+     */
9
+    margin: 10,
10
+
11
+    /**
12
+     * The application's default padding when non-zero padding is necessary.
13
+     */
14
+    padding: 10
15
+};

+ 21
- 6
react/features/base/styles/components/styles/ColorPalette.js 查看文件

@@ -1,11 +1,26 @@
1 1
 /**
2
- * The application color palette.
2
+ * The application's definition of the default color black.
3
+ */
4
+const BLACK = '#111111';
5
+
6
+/**
7
+ * The application's color palette.
3 8
  */
4 9
 export const ColorPalette = {
5
-    appBackground: '#111111',
10
+    /**
11
+     * The application's background color.
12
+     */
13
+    appBackground: BLACK,
14
+
15
+    /**
16
+     * The application's definition of the default color black. Generally,
17
+     * expected to be kept in sync with the application's background color for
18
+     * the sake of consistency.
19
+     */
20
+    black: BLACK,
21
+    blue: '#17A0DB',
6 22
     buttonUnderlay: '#495258',
7
-    jitsiBlue: '#17A0DB',
8
-    jitsiDarkGrey: '#555555',
9
-    jitsiRed: '#D00000',
10
-    jitsiToggled: '#495258'
23
+    darkGrey: '#555555',
24
+    red: '#D00000',
25
+    white: 'white'
11 26
 };

+ 1
- 0
react/features/base/styles/components/styles/index.js 查看文件

@@ -1 +1,2 @@
1
+export * from './BoxModel';
1 2
 export * from './ColorPalette';

+ 16
- 22
react/features/filmStrip/components/native/styles.js 查看文件

@@ -1,7 +1,19 @@
1
-import { createStyleSheet } from '../../../base/styles';
1
+import { ColorPalette, createStyleSheet } from '../../../base/styles';
2 2
 
3 3
 import { styles as platformIndependentStyles } from '../styles';
4 4
 
5
+/**
6
+ * The base/default style of indicators such as audioMutedIndicator,
7
+ * moderatorIndicator, and videoMutedIndicator.
8
+ */
9
+const indicator = {
10
+    textShadowColor: ColorPalette.black,
11
+    textShadowOffset: {
12
+        height: -1,
13
+        width: 0
14
+    }
15
+};
16
+
5 17
 /**
6 18
  * Native-specific styles for the film strip.
7 19
  */
@@ -10,13 +22,7 @@ export const styles = createStyleSheet(platformIndependentStyles, {
10 22
     /**
11 23
      * Audio muted indicator style.
12 24
      */
13
-    audioMutedIndicator: {
14
-        textShadowColor: 'black',
15
-        textShadowOffset: {
16
-            height: -1,
17
-            width: 0
18
-        }
19
-    },
25
+    audioMutedIndicator: indicator,
20 26
 
21 27
     /**
22 28
      * Dominant speaker indicator background style.
@@ -29,13 +35,7 @@ export const styles = createStyleSheet(platformIndependentStyles, {
29 35
     /**
30 36
      * Moderator indicator style.
31 37
      */
32
-    moderatorIndicator: {
33
-        textShadowColor: 'black',
34
-        textShadowOffset: {
35
-            height: -1,
36
-            width: 0
37
-        }
38
-    },
38
+    moderatorIndicator: indicator,
39 39
 
40 40
     /**
41 41
      * Video thumbnail style.
@@ -48,11 +48,5 @@ export const styles = createStyleSheet(platformIndependentStyles, {
48 48
    /**
49 49
      * Video muted indicator style.
50 50
      */
51
-    videoMutedIndicator: {
52
-        textShadowColor: 'black',
53
-        textShadowOffset: {
54
-            height: -1,
55
-            width: 0
56
-        }
57
-    }
51
+    videoMutedIndicator: indicator
58 52
 });

+ 11
- 11
react/features/filmStrip/components/styles.js 查看文件

@@ -1,4 +1,4 @@
1
-import { ColorPalette } from '../../base/styles';
1
+import { BoxModel, ColorPalette } from '../../base/styles';
2 2
 
3 3
 /**
4 4
  * Film strip related styles common to both Web and native.
@@ -9,7 +9,7 @@ export const styles = {
9 9
      */
10 10
     audioMutedIndicator: {
11 11
         backgroundColor: 'transparent',
12
-        color: 'white',
12
+        color: ColorPalette.white,
13 13
         left: 20,
14 14
         position: 'absolute',
15 15
         top: 1
@@ -19,7 +19,7 @@ export const styles = {
19 19
      * Dominant speaker indicator style.
20 20
      */
21 21
     dominantSpeakerIndicator: {
22
-        color: 'white',
22
+        color: ColorPalette.white,
23 23
         fontSize: 15
24 24
     },
25 25
 
@@ -27,7 +27,7 @@ export const styles = {
27 27
      * Dominant speaker indicator background style.
28 28
      */
29 29
     dominantSpeakerIndicatorBackground: {
30
-        backgroundColor: ColorPalette.jitsiBlue,
30
+        backgroundColor: ColorPalette.blue,
31 31
         borderRadius: 15,
32 32
         bottom: 2,
33 33
         left: 1,
@@ -41,7 +41,7 @@ export const styles = {
41 41
     filmStrip: {
42 42
         alignItems: 'flex-end',
43 43
         alignSelf: 'stretch',
44
-        bottom: 10,
44
+        bottom: BoxModel.margin,
45 45
         flex: 1,
46 46
         flexDirection: 'column',
47 47
         left: 0,
@@ -55,7 +55,7 @@ export const styles = {
55 55
      * to allow scrolling through them if they do not fit within the display.
56 56
      */
57 57
     filmStripScrollViewContentContainer: {
58
-        paddingHorizontal: 10
58
+        paddingHorizontal: BoxModel.padding
59 59
     },
60 60
 
61 61
     /**
@@ -63,7 +63,7 @@ export const styles = {
63 63
      */
64 64
     moderatorIndicator: {
65 65
         backgroundColor: 'transparent',
66
-        color: 'white',
66
+        color: ColorPalette.white,
67 67
         left: 1,
68 68
         position: 'absolute',
69 69
         top: 1
@@ -74,7 +74,7 @@ export const styles = {
74 74
      */
75 75
     thumbnail: {
76 76
         alignItems: 'stretch',
77
-        backgroundColor: 'black',
77
+        backgroundColor: ColorPalette.appBackground,
78 78
         borderColor: '#424242',
79 79
         borderStyle: 'solid',
80 80
         borderWidth: 1,
@@ -88,8 +88,8 @@ export const styles = {
88 88
      * Pinned video thumbnail style.
89 89
      */
90 90
     thumbnailPinned: {
91
-        borderColor: ColorPalette.jitsiBlue,
92
-        shadowColor: 'black',
91
+        borderColor: ColorPalette.blue,
92
+        shadowColor: ColorPalette.black,
93 93
         shadowOffset: {
94 94
             height: 5,
95 95
             width: 5
@@ -102,7 +102,7 @@ export const styles = {
102 102
      */
103 103
     videoMutedIndicator: {
104 104
         backgroundColor: 'transparent',
105
-        color: 'white',
105
+        color: ColorPalette.white,
106 106
         left: 35,
107 107
         position: 'absolute',
108 108
         top: 1

+ 1
- 1
react/features/toolbar/components/Toolbar.native.js 查看文件

@@ -76,7 +76,7 @@ class Toolbar extends AbstractToolbar {
76 76
                         onClick = { this._onHangup }
77 77
                         style = {{
78 78
                             ...styles.toolbarButton,
79
-                            backgroundColor: ColorPalette.jitsiRed
79
+                            backgroundColor: ColorPalette.red
80 80
                         }}
81 81
                         underlayColor = { underlayColor } />
82 82
                     <ToolbarButton

+ 4
- 4
react/features/toolbar/components/styles.js 查看文件

@@ -35,7 +35,7 @@ const container = {
35 35
  */
36 36
 const icon = {
37 37
     alignSelf: 'center',
38
-    color: ColorPalette.jitsiDarkGrey,
38
+    color: ColorPalette.darkGrey,
39 39
     fontSize: 24
40 40
 };
41 41
 
@@ -49,7 +49,7 @@ export const styles = createStyleSheet({
49 49
      */
50 50
     icon: {
51 51
         ...icon,
52
-        color: ColorPalette.jitsiDarkGrey
52
+        color: ColorPalette.darkGrey
53 53
     },
54 54
 
55 55
     /**
@@ -74,7 +74,7 @@ export const styles = createStyleSheet({
74 74
      */
75 75
     toolbarButton: {
76 76
         ...button,
77
-        backgroundColor: 'white',
77
+        backgroundColor: ColorPalette.white,
78 78
         marginLeft: 20,
79 79
         marginRight: 20,
80 80
         opacity: 0.8
@@ -104,6 +104,6 @@ export const styles = createStyleSheet({
104 104
      */
105 105
     whiteIcon: {
106 106
         ...icon,
107
-        color: 'white'
107
+        color: ColorPalette.white
108 108
     }
109 109
 });

+ 47
- 5
react/features/welcome/components/WelcomePage.native.js 查看文件

@@ -2,12 +2,23 @@ import React from 'react';
2 2
 import { Text, TextInput, TouchableHighlight, View } from 'react-native';
3 3
 import { connect } from 'react-redux';
4 4
 
5
-import {
6
-    AbstractWelcomePage,
7
-    mapStateToProps
8
-} from './AbstractWelcomePage';
5
+import { Link } from '../../base/react';
6
+import { ColorPalette } from '../../base/styles';
7
+
8
+import { AbstractWelcomePage, mapStateToProps } from './AbstractWelcomePage';
9 9
 import { styles } from './styles';
10 10
 
11
+/**
12
+ * The URL at which the privacy policy is available to the user.
13
+ */
14
+const PRIVACY_POLICY_URL = 'https://www.atlassian.com/legal/privacy-policy';
15
+
16
+/**
17
+ * The URL at which the terms of service are available to the user.
18
+ */
19
+const TERMS_OF_SERVICE_URL
20
+    = 'https://www.atlassian.com/legal/customer-agreement';
21
+
11 22
 /**
12 23
  * The native container rendering the welcome page.
13 24
  *
@@ -25,6 +36,25 @@ class WelcomePage extends AbstractWelcomePage {
25 36
                 {
26 37
                     this._renderLocalVideo()
27 38
                 }
39
+                {
40
+                    this._renderLocalVideoOverlay()
41
+                }
42
+            </View>
43
+        );
44
+    }
45
+
46
+    /**
47
+     * Renders a View over the local video. The latter is thought of as the
48
+     * background (content) of this WelcomePage. The former is thought of as the
49
+     * foreground (content) of this WelcomePage such as the room name input, the
50
+     * button to initiate joining the specified room, etc.
51
+     *
52
+     * @private
53
+     * @returns {ReactElement}
54
+     */
55
+    _renderLocalVideoOverlay() {
56
+        return (
57
+            <View style = { styles.localVideoOverlay }>
28 58
                 <View style = { styles.roomContainer }>
29 59
                     <Text style = { styles.title }>Enter room name</Text>
30 60
                     <TextInput
@@ -39,10 +69,22 @@ class WelcomePage extends AbstractWelcomePage {
39 69
                         disabled = { this._isJoinDisabled() }
40 70
                         onPress = { this._onJoinClick }
41 71
                         style = { styles.button }
42
-                        underlayColor = 'white'>
72
+                        underlayColor = { ColorPalette.white }>
43 73
                         <Text style = { styles.buttonText }>JOIN</Text>
44 74
                     </TouchableHighlight>
45 75
                 </View>
76
+                <View style = { styles.legaleseContainer }>
77
+                    <Link
78
+                        style = { styles.legaleseItem }
79
+                        url = { PRIVACY_POLICY_URL }>
80
+                        Privacy Policy
81
+                    </Link>
82
+                    <Link
83
+                        style = { styles.legaleseItem }
84
+                        url = { TERMS_OF_SERVICE_URL }>
85
+                        Terms of Service
86
+                    </Link>
87
+                </View>
46 88
             </View>
47 89
         );
48 90
     }

+ 55
- 37
react/features/welcome/components/styles.js 查看文件

@@ -1,39 +1,26 @@
1
-import { ColorPalette, createStyleSheet } from '../../base/styles';
1
+import { BoxModel, ColorPalette, createStyleSheet } from '../../base/styles';
2 2
 
3 3
 /**
4
- * Welcome page container style.
4
+ * The default color of text on the WelcomePage.
5 5
  */
6
-const container = {
7
-    alignSelf: 'stretch',
8
-    backgroundColor: ColorPalette.jitsiBlue,
9
-    bottom: 0,
10
-    flex: 1,
11
-    flexDirection: 'column',
12
-    justifyContent: 'center',
13
-    left: 0,
14
-    position: 'absolute',
15
-    right: 0,
16
-    top: 0
17
-};
6
+const TEXT_COLOR = ColorPalette.white;
18 7
 
19 8
 /**
20
- * The welcome page style.
21
- * TODO: Make styles more generic and reusable. Use color palette for all
22
- * colors.
9
+ * The styles of WelcomePage.
23 10
  */
24 11
 export const styles = createStyleSheet({
25 12
     /**
26
-     * Join button text style.
13
+     * Join button style.
27 14
      */
28 15
     button: {
29
-        backgroundColor: 'white',
30
-        borderColor: 'white',
16
+        backgroundColor: ColorPalette.white,
17
+        borderColor: ColorPalette.white,
31 18
         borderRadius: 8,
32 19
         borderWidth: 1,
33 20
         height: 45,
34 21
         justifyContent: 'center',
35
-        marginBottom: 10,
36
-        marginTop: 10
22
+        marginBottom: BoxModel.margin,
23
+        marginTop: BoxModel.margin
37 24
     },
38 25
 
39 26
     /**
@@ -46,25 +33,56 @@ export const styles = createStyleSheet({
46 33
     },
47 34
 
48 35
     /**
49
-     * Welcome page container style.
36
+     * The style of the top-level container of WelcomePage.
50 37
      */
51
-    container,
38
+    container: {
39
+        alignSelf: 'stretch',
40
+        backgroundColor: ColorPalette.blue,
41
+        flex: 1
42
+    },
52 43
 
53 44
     /**
54
-     * Container for room name input box and 'join' button.
45
+     * The style of the legal-related content such as (hyper)links to Privacy
46
+     * Policy and Terms of Service displayed on the WelcomePage.
55 47
      */
56
-    roomContainer: {
57
-        ...container,
58
-        backgroundColor: 'transparent',
59
-        padding: 30
48
+    legaleseContainer: {
49
+        flex: 0,
50
+        flexDirection: 'row',
51
+        justifyContent: 'center'
60 52
     },
61 53
 
62 54
     /**
63
-     * Navigator container style.
55
+     * The style of a piece of legal-related content such as a (hyper)link to
56
+     * Privacy Policy or Terms of Service displayed on the WelcomePage.
64 57
      */
65
-    navContainer: {
66
-        backgroundColor: ColorPalette.appBackground,
67
-        flex: 1
58
+    legaleseItem: {
59
+        color: TEXT_COLOR,
60
+        margin: BoxModel.margin
61
+    },
62
+
63
+    /**
64
+     * The style of the View displayed over the local video. The latter is
65
+     * thought of as the background (content) of WelcomePage. The former is
66
+     * thought of as the foreground (content) of WelcomePage.
67
+     */
68
+    localVideoOverlay: {
69
+        bottom: 0,
70
+        flex: 1,
71
+        flexDirection: 'column',
72
+        left: 0,
73
+        position: 'absolute',
74
+        right: 0,
75
+        top: 0
76
+    },
77
+
78
+    /**
79
+     * Container for room name input box and 'join' button.
80
+     */
81
+    roomContainer: {
82
+        flex: 1,
83
+        flexDirection: 'column',
84
+        justifyContent: 'center',
85
+        margin: 3 * BoxModel.margin
68 86
     },
69 87
 
70 88
     /**
@@ -72,11 +90,11 @@ export const styles = createStyleSheet({
72 90
      */
73 91
     textInput: {
74 92
         backgroundColor: 'transparent',
75
-        borderColor: 'white',
93
+        borderColor: ColorPalette.white,
76 94
         borderRadius: 8,
77 95
         borderStyle: 'solid',
78 96
         borderWidth: 1,
79
-        color: 'white',
97
+        color: TEXT_COLOR,
80 98
         fontSize: 23,
81 99
         height: 50,
82 100
         padding: 4,
@@ -87,9 +105,9 @@ export const styles = createStyleSheet({
87 105
      * Application title style.
88 106
      */
89 107
     title: {
90
-        color: '#fff',
108
+        color: TEXT_COLOR,
91 109
         fontSize: 25,
92
-        marginBottom: 20,
110
+        marginBottom: 2 * BoxModel.margin,
93 111
         textAlign: 'center'
94 112
     }
95 113
 });

正在加载...
取消
保存