Convert ManualDeviceKeyVerificationDialog to TS
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
e80939d3e2
commit
4ca2ab11fb
1 changed files with 13 additions and 19 deletions
|
@ -19,37 +19,31 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { MatrixClientPeg } from '../../../MatrixClientPeg';
|
import { MatrixClientPeg } from '../../../MatrixClientPeg';
|
||||||
import * as sdk from '../../../index';
|
|
||||||
import * as FormattingUtils from '../../../utils/FormattingUtils';
|
import * as FormattingUtils from '../../../utils/FormattingUtils';
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||||
|
import QuestionDialog from "./QuestionDialog";
|
||||||
|
import { DeviceInfo } from "matrix-js-sdk/src/crypto/deviceinfo";
|
||||||
|
|
||||||
@replaceableComponent("views.dialogs.ManualDeviceKeyVerificationDialog")
|
interface IProps {
|
||||||
export default class ManualDeviceKeyVerificationDialog extends React.Component {
|
userId: string;
|
||||||
static propTypes = {
|
device: DeviceInfo;
|
||||||
userId: PropTypes.string.isRequired,
|
onFinished: (confirmed: boolean) => void;
|
||||||
device: PropTypes.object.isRequired,
|
|
||||||
onFinished: PropTypes.func.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
_onCancelClick = () => {
|
|
||||||
this.props.onFinished(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_onLegacyFinished = (confirm) => {
|
@replaceableComponent("views.dialogs.ManualDeviceKeyVerificationDialog")
|
||||||
|
export default class ManualDeviceKeyVerificationDialog extends React.Component<IProps> {
|
||||||
|
private onLegacyFinished = (confirm: boolean): void => {
|
||||||
if (confirm) {
|
if (confirm) {
|
||||||
MatrixClientPeg.get().setDeviceVerified(
|
MatrixClientPeg.get().setDeviceVerified(
|
||||||
this.props.userId, this.props.device.deviceId, true,
|
this.props.userId, this.props.device.deviceId, true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.props.onFinished(confirm);
|
this.props.onFinished(confirm);
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
|
||||||
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
|
||||||
|
|
||||||
|
public render(): JSX.Element {
|
||||||
let text;
|
let text;
|
||||||
if (MatrixClientPeg.get().getUserId() === this.props.userId) {
|
if (MatrixClientPeg.get().getUserId() === this.props.userId) {
|
||||||
text = _t("Confirm by comparing the following with the User Settings in your other session:");
|
text = _t("Confirm by comparing the following with the User Settings in your other session:");
|
||||||
|
@ -81,7 +75,7 @@ export default class ManualDeviceKeyVerificationDialog extends React.Component {
|
||||||
title={_t("Verify session")}
|
title={_t("Verify session")}
|
||||||
description={body}
|
description={body}
|
||||||
button={_t("Verify session")}
|
button={_t("Verify session")}
|
||||||
onFinished={this._onLegacyFinished}
|
onFinished={this.onLegacyFinished}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
Loading…
Reference in a new issue