mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-21 02:11:54 +01:00
[PM-6426] Fixing issues identified in code review
This commit is contained in:
parent
a0da892407
commit
84444ebf17
@ -17,7 +17,7 @@ export class GeneratePasswordToClipboardCommand {
|
||||
private autofillSettingsService: AutofillSettingsServiceAbstraction,
|
||||
private taskSchedulerService?: BrowserTaskSchedulerService,
|
||||
) {
|
||||
void this.taskSchedulerService?.registerTaskHandler(
|
||||
this.taskSchedulerService?.registerTaskHandler(
|
||||
ScheduledTaskNames.generatePasswordClearClipboardTimeout,
|
||||
() => ClearClipboard.run(),
|
||||
);
|
||||
|
@ -516,7 +516,7 @@ export default class MainBackground {
|
||||
this.logService,
|
||||
this.stateProvider,
|
||||
);
|
||||
void this.taskSchedulerService.registerTaskHandler(
|
||||
this.taskSchedulerService.registerTaskHandler(
|
||||
ScheduledTaskNames.scheduleNextSyncInterval,
|
||||
() => this.fullSync(),
|
||||
);
|
||||
|
@ -29,8 +29,11 @@ export class BrowserTaskSchedulerServiceImplementation
|
||||
private activeAlarmsState: GlobalState<ActiveAlarm[]>;
|
||||
readonly activeAlarms$: Observable<ActiveAlarm[]>;
|
||||
|
||||
constructor(logService: LogService, stateProvider: StateProvider) {
|
||||
super(logService, stateProvider);
|
||||
constructor(
|
||||
logService: LogService,
|
||||
private stateProvider: StateProvider,
|
||||
) {
|
||||
super(logService);
|
||||
|
||||
this.activeAlarmsState = this.stateProvider.getGlobal(ACTIVE_ALARMS);
|
||||
this.activeAlarms$ = this.activeAlarmsState.state$.pipe(
|
||||
@ -420,7 +423,7 @@ export class BrowserTaskSchedulerServiceImplementation
|
||||
*
|
||||
* @param alarmName - The name of the alarm to get.
|
||||
*/
|
||||
private async getAlarm(alarmName: string): Promise<chrome.alarms.Alarm> {
|
||||
private getAlarm(alarmName: string): Promise<chrome.alarms.Alarm> {
|
||||
if (this.isNonChromeEnvironment()) {
|
||||
return browser.alarms.get(alarmName);
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ export class LoginStrategyService implements LoginStrategyServiceAbstraction {
|
||||
this.authRequestPushNotificationState = this.stateProvider.get(
|
||||
AUTH_REQUEST_PUSH_NOTIFICATION_KEY,
|
||||
);
|
||||
void this.taskSchedulerService?.registerTaskHandler(
|
||||
this.taskSchedulerService?.registerTaskHandler(
|
||||
ScheduledTaskNames.loginStrategySessionTimeout,
|
||||
() => this.clearCache(),
|
||||
);
|
||||
|
@ -1,7 +1,4 @@
|
||||
import { ScheduledTaskName } from "../enums/scheduled-task-name.enum";
|
||||
import { StateProvider } from "../state";
|
||||
|
||||
import { LogService } from "./log.service";
|
||||
|
||||
export type TaskIdentifier = {
|
||||
taskName?: ScheduledTaskName;
|
||||
@ -10,10 +7,6 @@ export type TaskIdentifier = {
|
||||
};
|
||||
|
||||
export abstract class TaskSchedulerService {
|
||||
constructor(
|
||||
protected logService: LogService,
|
||||
protected stateProvider: StateProvider,
|
||||
) {}
|
||||
protected taskHandlers: Map<string, () => void>;
|
||||
abstract setTimeout(
|
||||
taskName: ScheduledTaskName,
|
||||
|
@ -1,11 +1,10 @@
|
||||
import { LogService } from "../abstractions/log.service";
|
||||
import { TaskIdentifier, TaskSchedulerService } from "../abstractions/task-scheduler.service";
|
||||
import { ScheduledTaskName } from "../enums/scheduled-task-name.enum";
|
||||
import { StateProvider } from "../state";
|
||||
|
||||
export class DefaultTaskSchedulerService extends TaskSchedulerService {
|
||||
constructor(logService: LogService, stateProvider: StateProvider) {
|
||||
super(logService, stateProvider);
|
||||
constructor(protected logService: LogService) {
|
||||
super();
|
||||
|
||||
this.taskHandlers = new Map();
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ export class SystemService implements SystemServiceAbstraction {
|
||||
private accountService: AccountService,
|
||||
private taskSchedulerService?: TaskSchedulerService,
|
||||
) {
|
||||
void this.taskSchedulerService?.registerTaskHandler(
|
||||
this.taskSchedulerService?.registerTaskHandler(
|
||||
ScheduledTaskNames.systemClearClipboardTimeout,
|
||||
() => this.clearPendingClipboard(),
|
||||
);
|
||||
|
@ -23,9 +23,8 @@ export class EventUploadService implements EventUploadServiceAbstraction {
|
||||
private authService: AuthService,
|
||||
private taskSchedulerService?: TaskSchedulerService,
|
||||
) {
|
||||
void this.taskSchedulerService?.registerTaskHandler(
|
||||
ScheduledTaskNames.eventUploadsInterval,
|
||||
() => this.uploadEvents(),
|
||||
this.taskSchedulerService?.registerTaskHandler(ScheduledTaskNames.eventUploadsInterval, () =>
|
||||
this.uploadEvents(),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ export class NotificationsService implements NotificationsServiceAbstraction {
|
||||
private messagingService: MessagingService,
|
||||
private taskSchedulerService?: TaskSchedulerService,
|
||||
) {
|
||||
void this.taskSchedulerService?.registerTaskHandler(
|
||||
this.taskSchedulerService?.registerTaskHandler(
|
||||
ScheduledTaskNames.notificationsReconnectTimeout,
|
||||
() => this.reconnect(this.isSyncingOnReconnect),
|
||||
);
|
||||
|
@ -40,7 +40,7 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction {
|
||||
private loggedOutCallback: (expired: boolean, userId?: string) => Promise<void> = null,
|
||||
private taskSchedulerService?: TaskSchedulerService,
|
||||
) {
|
||||
void this.taskSchedulerService?.registerTaskHandler(
|
||||
this.taskSchedulerService?.registerTaskHandler(
|
||||
ScheduledTaskNames.vaultTimeoutCheckInterval,
|
||||
() => this.checkVaultTimeout(),
|
||||
);
|
||||
|
@ -63,9 +63,8 @@ export class Fido2ClientService implements Fido2ClientServiceAbstraction {
|
||||
private taskSchedulerService?: TaskSchedulerService,
|
||||
private logService?: LogService,
|
||||
) {
|
||||
void this.taskSchedulerService?.registerTaskHandler(
|
||||
ScheduledTaskNames.fido2ClientAbortTimeout,
|
||||
() => this.timeoutAbortController?.abort(),
|
||||
this.taskSchedulerService?.registerTaskHandler(ScheduledTaskNames.fido2ClientAbortTimeout, () =>
|
||||
this.timeoutAbortController?.abort(),
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user