Fix link-and-sync in Alpha

This commit is contained in:
Fedor Indutny 2024-10-28 14:13:30 -07:00 committed by GitHub
parent 6967a5d545
commit fa25d5aaf8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -59,6 +59,7 @@ import * as log from '../logging/log';
import type { StorageAccessType } from '../types/Storage';
import { getRelativePath, createName } from '../util/attachmentPath';
import { isBackupEnabled } from '../util/isBackupEnabled';
import { isLinkAndSyncEnabled } from '../util/isLinkAndSyncEnabled';
import { getMessageQueueTime } from '../util/getMessageQueueTime';
type StorageKeyByServiceIdKind = {
@ -1097,10 +1098,14 @@ export default class AccountManager extends EventTarget {
throw missingCaseError(options);
}
const shouldDownloadBackup =
isBackupEnabled() ||
(isLinkAndSyncEnabled(window.getVersion()) && options.ephemeralBackupKey);
// Set backup download path before storing credentials to ensure that
// storage service and message receiver are not operating
// until the backup is downloaded and imported.
if (isBackupEnabled() && cleanStart) {
if (shouldDownloadBackup && cleanStart) {
if (options.type === AccountType.Linked && options.ephemeralBackupKey) {
await storage.put('backupEphemeralKey', options.ephemeralBackupKey);
}