From 43872f82ccd7453926c75240ecde196151e89ce9 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 13 Feb 2019 22:08:55 -0500 Subject: [PATCH] cant be pin locked without key --- src/services/lock.service.ts | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/src/services/lock.service.ts b/src/services/lock.service.ts index 1576c1582c..941e86f249 100644 --- a/src/services/lock.service.ts +++ b/src/services/lock.service.ts @@ -35,10 +35,10 @@ export class LockService implements LockServiceAbstraction { } async isLocked(): Promise { - if (this.pinLocked) { + const hasKey = await this.cryptoService.hasKey(); + if (hasKey && this.pinLocked) { return true; } - const hasKey = await this.cryptoService.hasKey(); return !hasKey; } @@ -48,13 +48,7 @@ export class LockService implements LockServiceAbstraction { return; } - if (this.pinLocked) { - return; - } - - const hasKey = await this.cryptoService.hasKey(); - if (!hasKey) { - // no key so no need to lock + if (this.isLocked()) { return; } @@ -83,7 +77,11 @@ export class LockService implements LockServiceAbstraction { if (allowSoftLock) { const pinSet = await this.isPinLockSet(); if (pinSet[0]) { - await this.pinLock(); + this.pinLocked = true; + this.messagingService.send('locked'); + if (this.lockedCallback != null) { + await this.lockedCallback(); + } return; } } @@ -119,12 +117,4 @@ export class LockService implements LockServiceAbstraction { clear(): Promise { return this.storageService.remove(ConstantsService.protectedPin); } - - private async pinLock(): Promise { - this.pinLocked = true; - this.messagingService.send('locked'); - if (this.lockedCallback != null) { - await this.lockedCallback(); - } - } }