mirror of
https://github.com/bitwarden/browser
synced 2026-01-31 16:53:27 +00:00
Cleanup
This commit is contained in:
@@ -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)),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user