Bläddra i källkod

e2ee: add label if all participants have E2EE enabled

master
Saúl Ibarra Corretgé 5 år sedan
förälder
incheckning
5ea8e198c7

+ 7
- 0
css/modals/video-quality/_video-quality.scss Visa fil

@@ -164,6 +164,13 @@
164 164
         background: #B8C7E0;
165 165
     }
166 166
 
167
+    .circular-label.e2ee {
168
+        align-items: center;
169
+        background: #76CF9C;
170
+        display: flex;
171
+        justify-content: center;
172
+    }
173
+
167 174
     .circular-label.file {
168 175
         background: #FF5630;
169 176
     }

+ 3
- 0
lang/main.json Visa fil

@@ -294,6 +294,9 @@
294 294
     "documentSharing": {
295 295
         "title": "Shared Document"
296 296
     },
297
+    "e2ee": {
298
+        "labelToolTip": "All participants in this meeting have enabled End-to-End encryption"
299
+    },
297 300
     "feedback": {
298 301
         "average": "Average",
299 302
         "bad": "Bad",

+ 3
- 0
react/features/base/icons/svg/e2ee.svg Visa fil

@@ -0,0 +1,3 @@
1
+<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+<path fill-rule="evenodd" clip-rule="evenodd" d="M3.75 7.5H5.25H12.75H14.25V15H3.75V7.5ZM14.25 6H12.75V5.25C12.75 3.17893 11.0711 1.5 9 1.5C6.92893 1.5 5.25 3.17893 5.25 5.25V6H3.75C2.92157 6 2.25 6.67157 2.25 7.5V15C2.25 15.8284 2.92157 16.5 3.75 16.5H14.25C15.0784 16.5 15.75 15.8284 15.75 15V7.5C15.75 6.67157 15.0784 6 14.25 6ZM9.72642 11.8127C10.1877 11.5568 10.5 11.0649 10.5 10.5C10.5 9.67157 9.82843 9 9 9C8.17157 9 7.5 9.67157 7.5 10.5C7.5 11.0649 7.81226 11.5568 8.27358 11.8127C8.25819 11.8726 8.25 11.9353 8.25 12V12.75C8.25 13.1642 8.58579 13.5 9 13.5C9.41421 13.5 9.75 13.1642 9.75 12.75V12C9.75 11.9353 9.74181 11.8726 9.72642 11.8127ZM9 3C10.2426 3 11.25 4.00736 11.25 5.25V6H6.75V5.25C6.75 4.00736 7.75736 3 9 3Z" fill="white"/>
3
+</svg>

+ 1
- 0
react/features/base/icons/svg/index.js Visa fil

@@ -27,6 +27,7 @@ export { default as IconDeviceSpeaker } from './volume.svg';
27 27
 export { default as IconDominantSpeaker } from './dominant-speaker.svg';
28 28
 export { default as IconDownload } from './download.svg';
29 29
 export { default as IconDragHandle } from './drag-handle.svg';
30
+export { default as IconE2EE } from './e2ee.svg';
30 31
 export { default as IconEventNote } from './event_note.svg';
31 32
 export { default as IconExclamation } from './exclamation.svg';
32 33
 export { default as IconExclamationSolid } from './exclamation-solid.svg';

+ 3
- 2
react/features/base/label/components/AbstractCircularLabel.js Visa fil

@@ -1,12 +1,13 @@
1 1
 // @flow
2
+
2 3
 import { Component } from 'react';
3 4
 
4 5
 export type Props = {
5 6
 
6 7
     /**
7
-     * String that will be rendered as the label itself.
8
+     * String or component that will be rendered as the label itself.
8 9
      */
9
-    label: string
10
+    label: string | React$Node
10 11
 };
11 12
 
12 13
 /**

+ 13
- 0
react/features/conference/components/AbstractLabels.js Visa fil

@@ -2,6 +2,7 @@
2 2
 
3 3
 import React, { Component } from 'react';
4 4
 
5
+import { E2EELabel } from '../../e2ee';
5 6
 import { isFilmstripVisible } from '../../filmstrip';
6 7
 import { LocalRecordingLabel } from '../../local-recording';
7 8
 import { RecordingLabel } from '../../recording';
@@ -33,6 +34,18 @@ export type Props = {
33 34
  * @extends Component
34 35
  */
35 36
 export default class AbstractLabels<P: Props, S> extends Component<P, S> {
37
+    /**
38
+     * Renders the {@code E2EELabel}.
39
+     *
40
+     * @protected
41
+     * @returns {React$Element}
42
+     */
43
+    _renderE2EELabel() {
44
+        return (
45
+            <E2EELabel />
46
+        );
47
+    }
48
+
36 49
     /**
37 50
      * Renders the {@code LocalRecordingLabel}.
38 51
      *

+ 5
- 0
react/features/conference/components/web/Labels.js Visa fil

@@ -74,6 +74,9 @@ class Labels extends AbstractLabels<Props, State> {
74 74
 
75 75
         return (
76 76
             <div className = { className } >
77
+                {
78
+                    this._renderE2EELabel()
79
+                }
77 80
                 {
78 81
                     this._renderRecordingLabel(
79 82
                         JitsiRecordingConstants.mode.FILE)
@@ -96,6 +99,8 @@ class Labels extends AbstractLabels<Props, State> {
96 99
         );
97 100
     }
98 101
 
102
+    _renderE2EELabel: () => React$Element<*>;
103
+
99 104
     _renderLocalRecordingLabel: () => React$Element<*>;
100 105
 
101 106
     _renderRecordingLabel: string => React$Element<*>;

+ 30
- 0
react/features/e2ee/components/AbstractE2EELabel.js Visa fil

@@ -0,0 +1,30 @@
1
+// @flow
2
+
3
+
4
+export type Props = {
5
+
6
+    /**
7
+     * True if the label needs to be rendered, false otherwise.
8
+     */
9
+    _showLabel: boolean,
10
+
11
+    /**
12
+     * Invoked to obtain translated strings.
13
+     */
14
+    t: Function
15
+};
16
+
17
+/**
18
+ * Maps (parts of) the redux state to the associated props of this {@code Component}.
19
+ *
20
+ * @param {Object} state - The redux state.
21
+ * @private
22
+ * @returns {Props}
23
+ */
24
+export function _mapStateToProps(state: Object) {
25
+    const participants = state['features/base/participants'];
26
+
27
+    return {
28
+        _showLabel: participants.every(p => p.e2eeEnabled)
29
+    };
30
+}

+ 47
- 0
react/features/e2ee/components/E2EELabel.js Visa fil

@@ -0,0 +1,47 @@
1
+// @flow
2
+
3
+import Tooltip from '@atlaskit/tooltip';
4
+import React, { Component } from 'react';
5
+
6
+import { translate } from '../../base/i18n';
7
+import { Icon, IconE2EE } from '../../base/icons';
8
+import { CircularLabel } from '../../base/label';
9
+import { connect } from '../../base/redux';
10
+
11
+import { _mapStateToProps, type Props } from './AbstractE2EELabel';
12
+
13
+
14
+/**
15
+ * React {@code Component} for displaying a label when everyone has E2EE enabled in a conferene.
16
+ *
17
+ * @extends Component
18
+ */
19
+class E2EELabel extends Component<Props> {
20
+
21
+    /**
22
+     * Implements React's {@link Component#render()}.
23
+     *
24
+     * @inheritdoc
25
+     * @returns {ReactElement}
26
+     */
27
+    render() {
28
+        if (!this.props._showLabel) {
29
+            return null;
30
+        }
31
+
32
+        // eslint-disable-next-line react/jsx-max-props-per-line
33
+        const icon = <Icon size = { 22 } src = { IconE2EE } />;
34
+
35
+        return (
36
+            <Tooltip
37
+                content = { this.props.t('e2ee.labelToolTip') }
38
+                position = { 'left' }>
39
+                <CircularLabel
40
+                    className = 'e2ee'
41
+                    label = { icon } />
42
+            </Tooltip>
43
+        );
44
+    }
45
+}
46
+
47
+export default translate(connect(_mapStateToProps)(E2EELabel));

+ 2
- 0
react/features/e2ee/components/index.native.js Visa fil

@@ -0,0 +1,2 @@
1
+// TODO: implement later.
2
+export const E2EELabel = undefined;

react/features/e2ee/components/index.js → react/features/e2ee/components/index.web.js Visa fil

@@ -1,2 +1,3 @@
1 1
 export { default as E2EEButton } from './E2EEButton';
2 2
 export { default as E2EEDialog } from './E2EEDialog';
3
+export { default as E2EELabel } from './E2EELabel';

Laddar…
Avbryt
Spara