Replace Matrix.getKeyBackupEnabled
by MatrixClient.CryptoApi.getActiveSessionBackupVersion
(#28225)
* Migrating deprecated sync `MatrixClient.getKeyBackupEnabled` to async `MatrixClient.CryptoApi.getActiveSessionBackupVersion` in `NewRecoveryMethodDialog`. Rewrite `NewRecoveryMethodDialog` into a functional component to make it easier to handle the new async method. * Migrating deprecated sync `MatrixClient.getKeyBackupEnabled` to async `MatrixClient.CryptoApi.getActiveSessionBackupVersion` in `MatrixChat`.
This commit is contained in:
parent
85d2bf3a04
commit
1bb482f6f7
6 changed files with 312 additions and 72 deletions
|
@ -1631,8 +1631,12 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
|||
cli.on(CryptoEvent.KeyBackupFailed, async (errcode): Promise<void> => {
|
||||
let haveNewVersion: boolean | undefined;
|
||||
let newVersionInfo: KeyBackupInfo | null = null;
|
||||
const keyBackupEnabled = Boolean(
|
||||
cli.getCrypto() && (await cli.getCrypto()?.getActiveSessionBackupVersion()) !== null,
|
||||
);
|
||||
|
||||
// if key backup is still enabled, there must be a new backup in place
|
||||
if (cli.getKeyBackupEnabled()) {
|
||||
if (keyBackupEnabled) {
|
||||
haveNewVersion = true;
|
||||
} else {
|
||||
// otherwise check the server to see if there's a new one
|
||||
|
@ -1650,7 +1654,6 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
|||
import(
|
||||
"../../async-components/views/dialogs/security/NewRecoveryMethodDialog"
|
||||
) as unknown as Promise<typeof NewRecoveryMethodDialog>,
|
||||
{ newVersionInfo: newVersionInfo! },
|
||||
);
|
||||
} else {
|
||||
Modal.createDialogAsync(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue