check if authed before trying to lock

This commit is contained in:
Kyle Spearrin 2019-03-19 15:44:48 -04:00
parent d8f9177c03
commit fc1a73c9f2
1 changed files with 12 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import { MessagingService } from '../abstractions/messaging.service';
import { PlatformUtilsService } from '../abstractions/platformUtils.service';
import { SearchService } from '../abstractions/search.service';
import { StorageService } from '../abstractions/storage.service';
import { UserService } from '../abstractions/user.service';
export class LockService implements LockServiceAbstraction {
pinLocked = false;
@ -19,7 +20,7 @@ export class LockService implements LockServiceAbstraction {
private collectionService: CollectionService, private cryptoService: CryptoService,
private platformUtilsService: PlatformUtilsService, private storageService: StorageService,
private messagingService: MessagingService, private searchService: SearchService,
private lockedCallback: () => Promise<void> = null) {
private userService: UserService, private lockedCallback: () => Promise<void> = null) {
}
init(checkOnInterval: boolean) {
@ -48,6 +49,11 @@ export class LockService implements LockServiceAbstraction {
return;
}
const authed = await this.userService.isAuthenticated();
if (!authed) {
return;
}
if (await this.isLocked()) {
return;
}
@ -74,6 +80,11 @@ export class LockService implements LockServiceAbstraction {
}
async lock(allowSoftLock = false): Promise<void> {
const authed = await this.userService.isAuthenticated();
if (!authed) {
return;
}
if (allowSoftLock) {
const pinSet = await this.isPinLockSet();
if (pinSet[0]) {