Merge branch 'master' into sas-verification

This commit is contained in:
RMidhunSuresh 2023-03-28 15:19:53 +05:30
commit 18d735b771
2 changed files with 12 additions and 22 deletions

View File

@ -26,7 +26,8 @@ import type {CrossSigning} from "../../../matrix/verification/CrossSigning";
export enum Status { export enum Status {
Enabled, Enabled,
Setup, SetupWithPassphrase,
SetupWithRecoveryKey,
Pending, Pending,
NewVersionAvailable NewVersionAvailable
}; };
@ -108,7 +109,10 @@ export class KeyBackupViewModel extends ViewModel<SegmentType, Options> {
return keyBackup.needsNewKey ? Status.NewVersionAvailable : Status.Enabled; return keyBackup.needsNewKey ? Status.NewVersionAvailable : Status.Enabled;
} }
} else { } else {
return Status.Setup; switch (this._setupKeyType) {
case KeyType.RecoveryKey: return Status.SetupWithRecoveryKey;
case KeyType.Passphrase: return Status.SetupWithPassphrase;
}
} }
} }
@ -179,21 +183,13 @@ export class KeyBackupViewModel extends ViewModel<SegmentType, Options> {
} }
showPhraseSetup(): void { showPhraseSetup(): void {
if (this._status === Status.Setup) { this._setupKeyType = KeyType.Passphrase;
this._setupKeyType = KeyType.Passphrase; this.emitChange("status");
this.emitChange("setupKeyType");
}
} }
showKeySetup(): void { showKeySetup(): void {
if (this._status === Status.Setup) { this._setupKeyType = KeyType.RecoveryKey;
this._setupKeyType = KeyType.Passphrase; this.emitChange("status");
this.emitChange("setupKeyType");
}
}
get setupKeyType(): KeyType {
return this._setupKeyType;
} }
private async _enterCredentials(keyType, credential, setupDehydratedDevice): Promise<void> { private async _enterCredentials(keyType, credential, setupDehydratedDevice): Promise<void> {

View File

@ -27,14 +27,8 @@ export class KeyBackupSettingsView extends TemplateView<KeyBackupViewModel> {
switch (status) { switch (status) {
case Status.Enabled: return renderEnabled(t, vm); case Status.Enabled: return renderEnabled(t, vm);
case Status.NewVersionAvailable: return renderNewVersionAvailable(t, vm); case Status.NewVersionAvailable: return renderNewVersionAvailable(t, vm);
case Status.Setup: { case Status.SetupWithPassphrase: return renderEnableFromPhrase(t, vm);
if (vm.setupKeyType === KeyType.Passphrase) { case Status.SetupWithRecoveryKey: return renderEnableFromKey(t, vm);
return renderEnableFromPhrase(t, vm);
} else {
return renderEnableFromKey(t, vm);
}
break;
}
case Status.Pending: return t.p(vm.i18n`Waiting to go online…`); case Status.Pending: return t.p(vm.i18n`Waiting to go online…`);
} }
}), }),