convert more service abstractions
This commit is contained in:
parent
8d4799a0a2
commit
6c3f0a538f
|
@ -1,4 +1,4 @@
|
|||
export interface LockService {
|
||||
checkLock(): Promise<void>;
|
||||
lock(): Promise<void>;
|
||||
export abstract class LockService {
|
||||
checkLock: () => Promise<void>;
|
||||
lock: () => Promise<void>;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export interface StorageService {
|
||||
get<T>(key: string): Promise<T>;
|
||||
save(key: string, obj: any): Promise<any>;
|
||||
remove(key: string): Promise<any>;
|
||||
export abstract class StorageService {
|
||||
get: <T>(key: string) => Promise<T>;
|
||||
save: (key: string, obj: any) => Promise<any>;
|
||||
remove: (key: string) => Promise<any>;
|
||||
}
|
||||
|
|
|
@ -4,16 +4,16 @@ import { CipherService } from '../abstractions/cipher.service';
|
|||
import { CollectionService } from '../abstractions/collection.service';
|
||||
import { CryptoService } from '../abstractions/crypto.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 { StorageService } from '../abstractions/storage.service';
|
||||
|
||||
export class LockService implements LockServiceInterface {
|
||||
export class LockService implements LockServiceAbstraction {
|
||||
constructor(private cipherService: CipherService, private folderService: FolderService,
|
||||
private collectionService: CollectionService, private cryptoService: CryptoService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private storageService: StorageService,
|
||||
private setIcon: Function, private refreshBadgeAndMenu: Function) {
|
||||
private platformUtilsService: PlatformUtilsService, private storageService: StorageService,
|
||||
private messagingService: MessagingService) {
|
||||
this.checkLock();
|
||||
setInterval(() => this.checkLock(), 10 * 1000); // check every 10 seconds
|
||||
}
|
||||
|
@ -54,12 +54,11 @@ export class LockService implements LockServiceInterface {
|
|||
this.cryptoService.clearOrgKeys(true),
|
||||
this.cryptoService.clearPrivateKey(true),
|
||||
this.cryptoService.clearEncKey(true),
|
||||
this.setIcon(),
|
||||
this.refreshBadgeAndMenu(),
|
||||
]);
|
||||
|
||||
this.folderService.clearCache();
|
||||
this.cipherService.clearCache();
|
||||
this.collectionService.clearCache();
|
||||
this.messagingService.send('locked');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue