1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-31 16:53:27 +00:00
This commit is contained in:
Bernd Schoolmann
2025-10-30 12:57:42 +01:00
parent 2d8cc204a0
commit 8a9fea56b4

View File

@@ -1,4 +1,4 @@
import { combineLatest, map, switchMap, of, firstValueFrom, filter, tap, delay } from "rxjs";
import { combineLatest, switchMap, of, firstValueFrom, filter, delay, concatMap } from "rxjs";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
@@ -28,11 +28,6 @@ export const ENCRYPTED_MIGRATION_DISMISSED = new UserKeyDefinition<Date>(
);
const DISMISS_TIME_HOURS = 24;
type UserSyncData = {
userId: UserId;
lastSync: Date | null;
};
/**
* This services schedules encrypted migrations for users on clients that are interactive (non-cli), and handles manual interaction,
* if it is required by showing a UI prompt. It is only one means of triggering migrations, in case the user stays unlocked for a while,
@@ -71,9 +66,8 @@ export class DefaultEncryptedMigrationsSchedulerService
this.syncService.lastSync$(userId).pipe(filter((lastSync) => lastSync != null)),
]).pipe(
filter(([authStatus]) => authStatus === AuthenticationStatus.Unlocked),
map(([, lastSync]) => ({ userId, lastSync }) as UserSyncData),
delay(5_000),
tap(({ userId }) => this.runMigrationsIfNeeded(userId)),
concatMap(() => this.runMigrationsIfNeeded(userId)),
),
),
);