cram EncryptionPanel into a Dialog when clicking from new session dialog

This commit is contained in:
Bruno Windels 2020-01-31 14:01:32 +01:00
parent b210c9cb76
commit f368339b78
2 changed files with 41 additions and 17 deletions

View file

@ -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 <EncryptionPanel
verificationRequest={this.props.verificationRequest}
onClose={this.props.onFinished}
member={MatrixClientPeg.get().getUser(this.props.verificationRequest.otherUserId)}
/>;
}
}

View file

@ -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() {