From f368339b78824e5b23ad99bb1d0b9acbee1ae864 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 31 Jan 2020 14:01:32 +0100 Subject: [PATCH] cram EncryptionPanel into a Dialog when clicking from new session dialog --- .../views/dialogs/DeviceVerifyOwnDialog.js | 36 +++++++++++++++++++ .../views/dialogs/NewSessionReviewDialog.js | 22 +++--------- 2 files changed, 41 insertions(+), 17 deletions(-) create mode 100644 src/components/views/dialogs/DeviceVerifyOwnDialog.js diff --git a/src/components/views/dialogs/DeviceVerifyOwnDialog.js b/src/components/views/dialogs/DeviceVerifyOwnDialog.js new file mode 100644 index 0000000000..ca562062a8 --- /dev/null +++ b/src/components/views/dialogs/DeviceVerifyOwnDialog.js @@ -0,0 +1,36 @@ +/* +Copyright 2019, 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. +*/ + +import React from 'react'; +import PropTypes from 'prop-types'; +import {MatrixClientPeg} from '../../../MatrixClientPeg'; +import * as sdk from '../../../index'; + +export default class DeviceVerifyOwnDialog extends React.Component { + static propTypes = { + verificationRequest: PropTypes.object.isRequired, + onFinished: PropTypes.func.isRequired, + }; + + render() { + const EncryptionPanel = sdk.getComponent("views.right_panel.EncryptionPanel"); + return ; + } +} diff --git a/src/components/views/dialogs/NewSessionReviewDialog.js b/src/components/views/dialogs/NewSessionReviewDialog.js index c8e3992384..6d074d7045 100644 --- a/src/components/views/dialogs/NewSessionReviewDialog.js +++ b/src/components/views/dialogs/NewSessionReviewDialog.js @@ -14,13 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -import dis from "../../../dispatcher"; import React from 'react'; import PropTypes from 'prop-types'; import { _t } from '../../../languageHandler'; import Modal from '../../../Modal'; import { replaceableComponent } from '../../../utils/replaceableComponent'; -import DeviceVerifyDialog from './DeviceVerifyDialog'; +import DeviceVerifyOwnDialog from './DeviceVerifyOwnDialog'; import BaseDialog from './BaseDialog'; import DialogButtons from '../elements/DialogButtons'; import {verificationMethods} from 'matrix-js-sdk/src/crypto'; @@ -48,28 +47,17 @@ export default class NewSessionReviewDialog extends React.PureComponent { [verificationMethods.SAS, SHOW_QR_CODE_METHOD], [device.deviceId], ); - dis.dispatch({ - action: "set_right_panel_phase", - phase: RIGHT_PANEL_PHASES.EncryptionPanel, - refireParams: { - verificationRequest: request, - member: cli.getUser(request.otherUserId), - }, + + Modal.createTrackedDialog('New Session Verification', 'Starting dialog', DeviceVerifyOwnDialog, { + verificationRequest: request, }); + this.props.onFinished(true); // Modal.createTrackedDialog('New Session Verification', 'Starting dialog', DeviceVerifyDialog, { // userId, // [verificationMethods.SAS, SHOW_QR_CODE_METHOD], // [device.deviceId], // ); - // dis.dispatch({ - // action: "set_right_panel_phase", - // phase: RIGHT_PANEL_PHASES.EncryptionPanel, - // refireParams: { - // verificationRequest: request, - // member: cli.getUser(request.otherUserId), - // }, - // }); } render() {