always locked if not running in memory

This commit is contained in:
Kyle Spearrin 2017-12-27 15:39:31 -05:00
parent 488485da54
commit d92c6cc6c6

View file

@ -18,6 +18,7 @@ namespace Bit.App.Services
private readonly IAuthService _authService; private readonly IAuthService _authService;
private readonly IFingerprint _fingerprint; private readonly IFingerprint _fingerprint;
private bool _timerCreated = false; private bool _timerCreated = false;
private bool _firstLockCheck = true;
public LockService( public LockService(
ISettings settings, ISettings settings,
@ -45,6 +46,10 @@ 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)
{ {
@ -52,7 +57,7 @@ namespace Bit.App.Services
} }
// 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(!forceLock && !_appSettings.Locked) if(!firstlockCheck && !forceLock && !_appSettings.Locked)
{ {
// Lock seconds tells if they want to lock the app or not // Lock seconds tells if they want to lock the app or not
var lockSeconds = _settings.GetValueOrDefault(Constants.SettingLockSeconds, 60 * 15); var lockSeconds = _settings.GetValueOrDefault(Constants.SettingLockSeconds, 60 * 15);