From 7a5e172b88c959f94051db1f6d7424cf0ef8108f Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Fri, 24 Jan 2020 16:16:46 +0000
Subject: [PATCH] Apply a huge part of the decorations and copy
---
res/css/_components.scss | 2 +
.../views/right_panel/_EncryptionInfo.scss | 24 +
res/css/views/right_panel/_UserInfo.scss | 6 +-
.../views/right_panel/_VerificationPanel.scss | 21 +
src/components/structures/RightPanel.js | 25 +-
.../views/messages/MKeyVerificationRequest.js | 3 +-
.../views/right_panel/EncryptionInfo.js | 68 +-
.../views/right_panel/EncryptionPanel.js | 72 +-
src/components/views/right_panel/UserInfo.js | 619 ++++++++++--------
.../views/right_panel/VerificationPanel.js | 85 ++-
.../views/toasts/VerificationRequestToast.js | 6 +-
.../views/verification/VerificationShowSas.js | 55 +-
src/i18n/strings/en_EN.json | 18 +-
13 files changed, 586 insertions(+), 418 deletions(-)
create mode 100644 res/css/views/right_panel/_EncryptionInfo.scss
create mode 100644 res/css/views/right_panel/_VerificationPanel.scss
diff --git a/res/css/_components.scss b/res/css/_components.scss
index 60f749de9c..e19050dc7e 100644
--- a/res/css/_components.scss
+++ b/res/css/_components.scss
@@ -140,7 +140,9 @@
@import "./views/messages/_TextualEvent.scss";
@import "./views/messages/_UnknownBody.scss";
@import "./views/messages/_ViewSourceEvent.scss";
+@import "./views/right_panel/_EncryptionInfo.scss";
@import "./views/right_panel/_UserInfo.scss";
+@import "./views/right_panel/_VerificationPanel.scss";
@import "./views/room_settings/_AliasSettings.scss";
@import "./views/room_settings/_ColorSettings.scss";
@import "./views/rooms/_AppsDrawer.scss";
diff --git a/res/css/views/right_panel/_EncryptionInfo.scss b/res/css/views/right_panel/_EncryptionInfo.scss
new file mode 100644
index 0000000000..386eef8e7f
--- /dev/null
+++ b/res/css/views/right_panel/_EncryptionInfo.scss
@@ -0,0 +1,24 @@
+/*
+Copyright 2020 The Matrix.org Foundation C.I.C.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+.mx_UserInfo {
+ .mx_EncryptionInfo_spinner {
+ .mx_Spinner {
+ margin-top: 25px;
+ margin-bottom: 15px;
+ }
+ }
+}
diff --git a/res/css/views/right_panel/_UserInfo.scss b/res/css/views/right_panel/_UserInfo.scss
index 57ffd4982e..8aad5240aa 100644
--- a/res/css/views/right_panel/_UserInfo.scss
+++ b/res/css/views/right_panel/_UserInfo.scss
@@ -81,6 +81,7 @@ limitations under the License.
.mx_UserInfo_avatar > div {
max-width: 30vh;
margin: 0 auto;
+ transition: 1s;
}
.mx_UserInfo_avatar > div > div {
@@ -260,11 +261,6 @@ limitations under the License.
.mx_UserInfo_verify {
display: block;
- background-color: $accent-color;
- color: $accent-fg-color;
- border-radius: 4px;
- padding: 7px 1.5em;
- text-align: center;
margin: 16px 0;
}
}
diff --git a/res/css/views/right_panel/_VerificationPanel.scss b/res/css/views/right_panel/_VerificationPanel.scss
new file mode 100644
index 0000000000..84a82c9a5c
--- /dev/null
+++ b/res/css/views/right_panel/_VerificationPanel.scss
@@ -0,0 +1,21 @@
+/*
+Copyright 2020 The Matrix.org Foundation C.I.C.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+.mx_UserInfo {
+ .mx_VerificationPanel_verified_section .mx_E2EIcon {
+ margin: 0 auto;
+ }
+}
diff --git a/src/components/structures/RightPanel.js b/src/components/structures/RightPanel.js
index c01a3709e7..2188bda4f2 100644
--- a/src/components/structures/RightPanel.js
+++ b/src/components/structures/RightPanel.js
@@ -169,7 +169,6 @@ export default class RightPanel extends React.Component {
const MemberList = sdk.getComponent('rooms.MemberList');
const MemberInfo = sdk.getComponent('rooms.MemberInfo');
const UserInfo = sdk.getComponent('right_panel.UserInfo');
- const EncryptionPanel = sdk.getComponent('right_panel.EncryptionPanel');
const ThirdPartyMemberInfo = sdk.getComponent('rooms.ThirdPartyMemberInfo');
const NotificationPanel = sdk.getComponent('structures.NotificationPanel');
const FilePanel = sdk.getComponent('structures.FilePanel');
@@ -187,19 +186,22 @@ export default class RightPanel extends React.Component {
panel =
{_t("For extra security, verify this user by checking a one-time code on both of your devices.")}
-{_t("For maximum security, do this in person.")}
-{_t("Messages in this room are end-to-end encrypted.")}
+{_t("Your messages are secured and only you and the recipient have the unique keys to unlock them.")}
+{_t("For extra security, verify this user by checking a one-time code on both of your devices.")}
+{_t("For maximum security, do this in person.")}
+ { content } +Not a member nor request, not sure what to render
; - } +}; - return ( -{_t("Messages in this room are end-to-end encrypted.")}
-{_t("Your messages are secured and only you and the recipient have the unique keys to unlock them.")}
-{ text }
+ { verifyButton } + { devicesSection } +{ text }
- { verifyButton } - { devicesSection } -{_t("Ask %(displayName)s to scan your code, or open your camera to scan theirs:", { + displayName: member.displayName || member.name || member.userId, + }, { + a: t => { t }, + })}
+{_t("If you can't scan the code above, verify by comparing unique emoji.")}
+Waiting for {request.otherUserId} to accept ...
{request.otherUserId} is ready, start {verifyButton}
); + const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); + return ( +{_t("You've successfully verified %(displayName)s!", { + displayName: member.displayName || member.name || member.userId, + })}
+Verify all users in a room to ensure it's secure.
+Waiting for {request.otherUserId} to confirm ...
; - } else if (this.state.sasEvent) { + if (this.state.sasEvent) { const VerificationShowSas = sdk.getComponent('views.verification.VerificationShowSas'); - return (Setting up SAS verification...
); } } else if (request.done) { - returnverified {request.otherUserId}!!
; + return this.renderVerifiedPhase(); } else if (request.cancelled) { + // TODO check if this matches target + // TODO should this be a MODAL? returncancelled by {request.cancellingUserId}!
; } + return null; } _startSAS = async () => { @@ -79,7 +117,6 @@ export default class VerificationPanel extends React.PureComponent { }; _onSasMatchesClick = () => { - this.setState({sasWaitingForOtherParty: true}); this.state.sasEvent.confirm(); }; @@ -106,7 +143,7 @@ export default class VerificationPanel extends React.PureComponent { request.verifier.removeListener('show_sas', this._onVerifierShowSas); } this._hasVerifier = !!request.verifier; - this.forceUpdate(); + this.forceUpdate(); // TODO fix this }; componentDidMount() { diff --git a/src/components/views/toasts/VerificationRequestToast.js b/src/components/views/toasts/VerificationRequestToast.js index 479a3e3f93..769e0d36d0 100644 --- a/src/components/views/toasts/VerificationRequestToast.js +++ b/src/components/views/toasts/VerificationRequestToast.js @@ -76,10 +76,14 @@ export default class VerificationRequestToast extends React.PureComponent { } try { await request.accept(); + const cli = MatrixClientPeg.get(); dis.dispatch({ action: "set_right_panel_phase", phase: RIGHT_PANEL_PHASES.EncryptionPanel, - refireParams: {verificationRequest: request}, + refireParams: { + verificationRequest: request, + member: cli.getUser(request.otherUserId), + }, }); } catch (err) { console.error(err.message); diff --git a/src/components/views/verification/VerificationShowSas.js b/src/components/views/verification/VerificationShowSas.js index 8f39457689..693a3769a0 100644 --- a/src/components/views/verification/VerificationShowSas.js +++ b/src/components/views/verification/VerificationShowSas.js @@ -18,6 +18,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import * as sdk from '../../../index'; import { _t, _td } from '../../../languageHandler'; +import {PendingActionSpinner} from "../right_panel/EncryptionInfo"; +import AccessibleButton from "../elements/AccessibleButton"; function capFirst(s) { return s.charAt(0).toUpperCase() + s.slice(1); @@ -25,18 +27,26 @@ function capFirst(s) { export default class VerificationShowSas extends React.Component { static propTypes = { + displayName: PropTypes.string.isRequired, onDone: PropTypes.func.isRequired, onCancel: PropTypes.func.isRequired, sas: PropTypes.object.isRequired, + }; + + constructor(props) { + super(props); + + this.state = { + pending: false, + }; } - constructor() { - super(); - } + onMatchClick = () => { + this.setState({ pending: true }); + this.props.onDone(); + }; render() { - const DialogButtons = sdk.getComponent('views.elements.DialogButtons'); - let sasDisplay; let sasCaption; if (this.props.sas.emoji) { @@ -69,26 +79,33 @@ export default class VerificationShowSas extends React.Component { } else { return{sasCaption}
-{_t( - "For maximum security, we recommend you do this in person or use another " + - "trusted means of communication.", - )}
+{_t("For ultimate security, do this in person or use another way to communicate.")}
{sasDisplay} -