Parcourir la source

Hyperlinks to legalese such as Privacy Policy and Terms of Service

master
Lyubomir Marinov il y a 8 ans
Parent
révision
1f457dfca5

+ 87
- 0
react/features/base/react/components/Link.native.js Voir le fichier

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 Voir le fichier

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

+ 15
- 0
react/features/base/styles/components/styles/BoxModel.js Voir le fichier

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 Voir le fichier

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
 export const ColorPalette = {
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
     buttonUnderlay: '#495258',
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 Voir le fichier

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

+ 16
- 22
react/features/filmStrip/components/native/styles.js Voir le fichier

1
-import { createStyleSheet } from '../../../base/styles';
1
+import { ColorPalette, createStyleSheet } from '../../../base/styles';
2
 
2
 
3
 import { styles as platformIndependentStyles } from '../styles';
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
  * Native-specific styles for the film strip.
18
  * Native-specific styles for the film strip.
7
  */
19
  */
10
     /**
22
     /**
11
      * Audio muted indicator style.
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
      * Dominant speaker indicator background style.
28
      * Dominant speaker indicator background style.
29
     /**
35
     /**
30
      * Moderator indicator style.
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
      * Video thumbnail style.
41
      * Video thumbnail style.
48
    /**
48
    /**
49
      * Video muted indicator style.
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 Voir le fichier

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

+ 1
- 1
react/features/toolbar/components/Toolbar.native.js Voir le fichier

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

+ 4
- 4
react/features/toolbar/components/styles.js Voir le fichier

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

+ 47
- 5
react/features/welcome/components/WelcomePage.native.js Voir le fichier

2
 import { Text, TextInput, TouchableHighlight, View } from 'react-native';
2
 import { Text, TextInput, TouchableHighlight, View } from 'react-native';
3
 import { connect } from 'react-redux';
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
 import { styles } from './styles';
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
  * The native container rendering the welcome page.
23
  * The native container rendering the welcome page.
13
  *
24
  *
25
                 {
36
                 {
26
                     this._renderLocalVideo()
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
                 <View style = { styles.roomContainer }>
58
                 <View style = { styles.roomContainer }>
29
                     <Text style = { styles.title }>Enter room name</Text>
59
                     <Text style = { styles.title }>Enter room name</Text>
30
                     <TextInput
60
                     <TextInput
39
                         disabled = { this._isJoinDisabled() }
69
                         disabled = { this._isJoinDisabled() }
40
                         onPress = { this._onJoinClick }
70
                         onPress = { this._onJoinClick }
41
                         style = { styles.button }
71
                         style = { styles.button }
42
-                        underlayColor = 'white'>
72
+                        underlayColor = { ColorPalette.white }>
43
                         <Text style = { styles.buttonText }>JOIN</Text>
73
                         <Text style = { styles.buttonText }>JOIN</Text>
44
                     </TouchableHighlight>
74
                     </TouchableHighlight>
45
                 </View>
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
             </View>
88
             </View>
47
         );
89
         );
48
     }
90
     }

+ 55
- 37
react/features/welcome/components/styles.js Voir le fichier

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
 export const styles = createStyleSheet({
11
 export const styles = createStyleSheet({
25
     /**
12
     /**
26
-     * Join button text style.
13
+     * Join button style.
27
      */
14
      */
28
     button: {
15
     button: {
29
-        backgroundColor: 'white',
30
-        borderColor: 'white',
16
+        backgroundColor: ColorPalette.white,
17
+        borderColor: ColorPalette.white,
31
         borderRadius: 8,
18
         borderRadius: 8,
32
         borderWidth: 1,
19
         borderWidth: 1,
33
         height: 45,
20
         height: 45,
34
         justifyContent: 'center',
21
         justifyContent: 'center',
35
-        marginBottom: 10,
36
-        marginTop: 10
22
+        marginBottom: BoxModel.margin,
23
+        marginTop: BoxModel.margin
37
     },
24
     },
38
 
25
 
39
     /**
26
     /**
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
      */
90
      */
73
     textInput: {
91
     textInput: {
74
         backgroundColor: 'transparent',
92
         backgroundColor: 'transparent',
75
-        borderColor: 'white',
93
+        borderColor: ColorPalette.white,
76
         borderRadius: 8,
94
         borderRadius: 8,
77
         borderStyle: 'solid',
95
         borderStyle: 'solid',
78
         borderWidth: 1,
96
         borderWidth: 1,
79
-        color: 'white',
97
+        color: TEXT_COLOR,
80
         fontSize: 23,
98
         fontSize: 23,
81
         height: 50,
99
         height: 50,
82
         padding: 4,
100
         padding: 4,
87
      * Application title style.
105
      * Application title style.
88
      */
106
      */
89
     title: {
107
     title: {
90
-        color: '#fff',
108
+        color: TEXT_COLOR,
91
         fontSize: 25,
109
         fontSize: 25,
92
-        marginBottom: 20,
110
+        marginBottom: 2 * BoxModel.margin,
93
         textAlign: 'center'
111
         textAlign: 'center'
94
     }
112
     }
95
 });
113
 });

Chargement…
Annuler
Enregistrer