mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-27 17:18:04 +01:00
convert more service abstractions
This commit is contained in:
parent
8d4799a0a2
commit
6c3f0a538f
@ -1,4 +1,4 @@
|
|||||||
export interface LockService {
|
export abstract class LockService {
|
||||||
checkLock(): Promise<void>;
|
checkLock: () => Promise<void>;
|
||||||
lock(): Promise<void>;
|
lock: () => Promise<void>;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export interface StorageService {
|
export abstract class StorageService {
|
||||||
get<T>(key: string): Promise<T>;
|
get: <T>(key: string) => Promise<T>;
|
||||||
save(key: string, obj: any): Promise<any>;
|
save: (key: string, obj: any) => Promise<any>;
|
||||||
remove(key: string): Promise<any>;
|
remove: (key: string) => Promise<any>;
|
||||||
}
|
}
|
||||||
|
@ -4,16 +4,16 @@ import { CipherService } from '../abstractions/cipher.service';
|
|||||||
import { CollectionService } from '../abstractions/collection.service';
|
import { CollectionService } from '../abstractions/collection.service';
|
||||||
import { CryptoService } from '../abstractions/crypto.service';
|
import { CryptoService } from '../abstractions/crypto.service';
|
||||||
import { FolderService } from '../abstractions/folder.service';
|
import { FolderService } from '../abstractions/folder.service';
|
||||||
import { LockService as LockServiceInterface } from '../abstractions/lock.service';
|
import { LockService as LockServiceAbstraction } from '../abstractions/lock.service';
|
||||||
|
import { MessagingService } from '../abstractions/messaging.service';
|
||||||
import { PlatformUtilsService } from '../abstractions/platformUtils.service';
|
import { PlatformUtilsService } from '../abstractions/platformUtils.service';
|
||||||
import { StorageService } from '../abstractions/storage.service';
|
import { StorageService } from '../abstractions/storage.service';
|
||||||
|
|
||||||
export class LockService implements LockServiceInterface {
|
export class LockService implements LockServiceAbstraction {
|
||||||
constructor(private cipherService: CipherService, private folderService: FolderService,
|
constructor(private cipherService: CipherService, private folderService: FolderService,
|
||||||
private collectionService: CollectionService, private cryptoService: CryptoService,
|
private collectionService: CollectionService, private cryptoService: CryptoService,
|
||||||
private platformUtilsService: PlatformUtilsService,
|
private platformUtilsService: PlatformUtilsService, private storageService: StorageService,
|
||||||
private storageService: StorageService,
|
private messagingService: MessagingService) {
|
||||||
private setIcon: Function, private refreshBadgeAndMenu: Function) {
|
|
||||||
this.checkLock();
|
this.checkLock();
|
||||||
setInterval(() => this.checkLock(), 10 * 1000); // check every 10 seconds
|
setInterval(() => this.checkLock(), 10 * 1000); // check every 10 seconds
|
||||||
}
|
}
|
||||||
@ -54,12 +54,11 @@ export class LockService implements LockServiceInterface {
|
|||||||
this.cryptoService.clearOrgKeys(true),
|
this.cryptoService.clearOrgKeys(true),
|
||||||
this.cryptoService.clearPrivateKey(true),
|
this.cryptoService.clearPrivateKey(true),
|
||||||
this.cryptoService.clearEncKey(true),
|
this.cryptoService.clearEncKey(true),
|
||||||
this.setIcon(),
|
|
||||||
this.refreshBadgeAndMenu(),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
this.folderService.clearCache();
|
this.folderService.clearCache();
|
||||||
this.cipherService.clearCache();
|
this.cipherService.clearCache();
|
||||||
this.collectionService.clearCache();
|
this.collectionService.clearCache();
|
||||||
|
this.messagingService.send('locked');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user