mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-01-10 04:06:34 +01:00
distinguish between "waiting to go online" vs "backup not configured"
This commit is contained in:
parent
997666164c
commit
fd4eb6b50d
@ -53,12 +53,11 @@ export class KeyBackupViewModel extends ViewModel {
|
|||||||
const keyBackup = this._session.keyBackup.get();
|
const keyBackup = this._session.keyBackup.get();
|
||||||
if (keyBackup) {
|
if (keyBackup) {
|
||||||
status = keyBackup.needsNewKey ? Status.NewVersionAvailable : Status.Enabled;
|
status = keyBackup.needsNewKey ? Status.NewVersionAvailable : Status.Enabled;
|
||||||
} else {
|
} else if (keyBackup === null) {
|
||||||
status = this.showPhraseSetup() ? Status.SetupPhrase : Status.SetupKey;
|
status = this.showPhraseSetup() ? Status.SetupPhrase : Status.SetupKey;
|
||||||
} /* TODO: bring back "waiting to get online"
|
} else {
|
||||||
else {
|
|
||||||
status = Status.Pending;
|
status = Status.Pending;
|
||||||
} */
|
}
|
||||||
const changed = status !== this._status;
|
const changed = status !== this._status;
|
||||||
this._status = status;
|
this._status = status;
|
||||||
return changed;
|
return changed;
|
||||||
|
@ -289,9 +289,15 @@ export class Session {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
log.catch(err);
|
log.catch(err);
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {ObservableValue<KeyBackup | undefined | null}
|
||||||
|
* - `undefined` means, we're not done with catchup sync yet and haven't checked yet if key backup is configured
|
||||||
|
* - `null` means we've checked and key backup hasn't been configured correctly or at all.
|
||||||
|
*/
|
||||||
get keyBackup() {
|
get keyBackup() {
|
||||||
return this._keyBackup;
|
return this._keyBackup;
|
||||||
}
|
}
|
||||||
@ -468,7 +474,7 @@ export class Session {
|
|||||||
log.set("success", true);
|
log.set("success", true);
|
||||||
await this._writeSSSSKey(ssssKey);
|
await this._writeSSSSKey(ssssKey);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
const txn = await this._storage.readTxn([
|
const txn = await this._storage.readTxn([
|
||||||
this._storage.storeNames.session,
|
this._storage.storeNames.session,
|
||||||
@ -478,8 +484,14 @@ export class Session {
|
|||||||
const ssssKey = await ssssReadKey(txn);
|
const ssssKey = await ssssReadKey(txn);
|
||||||
if (ssssKey) {
|
if (ssssKey) {
|
||||||
// txn will end here as this does a network request
|
// txn will end here as this does a network request
|
||||||
await this._createKeyBackup(ssssKey, txn, log);
|
if (await this._createKeyBackup(ssssKey, txn, log)) {
|
||||||
this._keyBackup.get()?.flush(log);
|
this._keyBackup.get()?.flush(log);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!this._keyBackup.get()) {
|
||||||
|
// null means key backup isn't configured yet
|
||||||
|
// as opposed to undefined, which means we're still checking
|
||||||
|
this._keyBackup.set(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// restore unfinished operations, like sending out room keys
|
// restore unfinished operations, like sending out room keys
|
||||||
|
Loading…
x
Reference in New Issue
Block a user