VerificationPanel: avoid use of getStoredDevice (#11129)

* VerificationPanel: avoid use of `getStoredDevice`

This is deprecated and doesn't work with the rust-sdk.

* fix types
This commit is contained in:
Richard van der Hoff 2023-06-23 13:38:06 +01:00 committed by GitHub
parent 358c37ad69
commit 36c81f6416
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 100 additions and 23 deletions

View file

@ -15,7 +15,7 @@ limitations under the License.
*/
import React from "react";
import { DeviceInfo } from "matrix-js-sdk/src//crypto/deviceinfo";
import { Device } from "matrix-js-sdk/src/matrix";
import { GeneratedSas } from "matrix-js-sdk/src/crypto-api/verification";
import { _t, _td } from "../../../languageHandler";
@ -26,7 +26,10 @@ import { fixupColorFonts } from "../../../utils/FontManager";
interface IProps {
pending?: boolean;
displayName?: string; // required if pending is true
device?: DeviceInfo;
/** Details of the other device involved in the verification, if known */
otherDeviceDetails?: Device;
onDone: () => void;
onCancel: () => void;
sas: GeneratedSas;
@ -111,10 +114,11 @@ export default class VerificationShowSas extends React.Component<IProps, IState>
let text;
// device shouldn't be null in this situation but it can be, eg. if the device is
// logged out during verification
if (this.props.device) {
const otherDevice = this.props.otherDeviceDetails;
if (otherDevice) {
text = _t("Waiting for you to verify on your other device, %(deviceName)s (%(deviceId)s)…", {
deviceName: this.props.device ? this.props.device.getDisplayName() : "",
deviceId: this.props.device ? this.props.device.deviceId : "",
deviceName: otherDevice.displayName,
deviceId: otherDevice.deviceId,
});
} else {
text = _t("Waiting for you to verify on your other device…");