_firstLockCheck logic adjustments

This commit is contained in:
Kyle Spearrin 2017-12-27 16:36:01 -05:00
parent 98b70a647b
commit bd5fd72459

View file

@ -18,7 +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; private bool _firstLockCheck = false; // TODO: true when we want to support this
public LockService( public LockService(
ISettings settings, ISettings settings,
@ -56,11 +56,12 @@ namespace Bit.App.Services
return LockType.None; return LockType.None;
} }
// Lock seconds tells if they want to lock the app or not
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)
{ {
// Lock seconds tells if they want to lock the app or not
var lockSeconds = _settings.GetValueOrDefault(Constants.SettingLockSeconds, 60 * 15);
if(lockSeconds == -1) if(lockSeconds == -1)
{ {
return LockType.None; return LockType.None;
@ -74,6 +75,12 @@ namespace Bit.App.Services
} }
} }
// Skip first lock check if not using locking
if(firstlockCheck && lockSeconds == -1 && !forceLock && !_appSettings.Locked)
{
return LockType.None;
}
// What method are we using to unlock? // What method are we using to unlock?
var fingerprintUnlock = _settings.GetValueOrDefault(Constants.SettingFingerprintUnlockOn, false); var fingerprintUnlock = _settings.GetValueOrDefault(Constants.SettingFingerprintUnlockOn, false);
var pinUnlock = _settings.GetValueOrDefault(Constants.SettingPinUnlockOn, false); var pinUnlock = _settings.GetValueOrDefault(Constants.SettingPinUnlockOn, false);