logic adjustments for first lock check

This commit is contained in:
Kyle Spearrin 2017-12-27 17:05:33 -05:00
parent bd5fd72459
commit 175a41f275

View file

@ -46,10 +46,6 @@ namespace Bit.App.Services
public async Task<LockType> GetLockTypeAsync(bool forceLock) public async Task<LockType> GetLockTypeAsync(bool forceLock)
{ {
// Always locked if not already running in memory.
var firstlockCheck = _firstLockCheck;
_firstLockCheck = false;
// Only lock if they are logged in // Only lock if they are logged in
if(!_authService.IsAuthenticated) if(!_authService.IsAuthenticated)
{ {
@ -60,7 +56,7 @@ namespace Bit.App.Services
var lockSeconds = _settings.GetValueOrDefault(Constants.SettingLockSeconds, 60 * 15); var lockSeconds = _settings.GetValueOrDefault(Constants.SettingLockSeconds, 60 * 15);
// Are we forcing a lock? (i.e. clicking a button to lock the app manually, immediately) // Are we forcing a lock? (i.e. clicking a button to lock the app manually, immediately)
if(!firstlockCheck && !forceLock && !_appSettings.Locked) if(!_firstLockCheck && !forceLock && !_appSettings.Locked)
{ {
if(lockSeconds == -1) if(lockSeconds == -1)
{ {
@ -76,7 +72,7 @@ namespace Bit.App.Services
} }
// Skip first lock check if not using locking // Skip first lock check if not using locking
if(firstlockCheck && lockSeconds == -1 && !forceLock && !_appSettings.Locked) if(_firstLockCheck && lockSeconds == -1 && !forceLock && !_appSettings.Locked)
{ {
return LockType.None; return LockType.None;
} }
@ -104,10 +100,12 @@ namespace Bit.App.Services
if(TopPageIsLock()) if(TopPageIsLock())
{ {
// already locked // already locked
_firstLockCheck = false;
return; return;
} }
var lockType = await GetLockTypeAsync(forceLock); var lockType = await GetLockTypeAsync(forceLock);
_firstLockCheck = false;
if(lockType == LockType.None) if(lockType == LockType.None)
{ {
return; return;