mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-22 11:35:21 +01:00
check lock only if locked on all pages
This commit is contained in:
parent
19c46a472a
commit
13b9e01604
@ -7,8 +7,8 @@ namespace Bit.App.Abstractions
|
||||
public interface ILockService
|
||||
{
|
||||
void UpdateLastActivity();
|
||||
Task<LockType> GetLockTypeAsync(bool forceLock);
|
||||
Task CheckLockAsync(bool forceLock);
|
||||
Task<LockType> GetLockTypeAsync(bool forceLock, bool onlyIfAlreadyLocked = false);
|
||||
Task CheckLockAsync(bool forceLock, bool onlyIfAlreadyLocked = false);
|
||||
bool TopPageIsLock();
|
||||
}
|
||||
}
|
@ -30,7 +30,7 @@ namespace Bit.App.Controls
|
||||
BackgroundColor = Color.FromHex("efeff4");
|
||||
}
|
||||
|
||||
protected override void OnAppearing()
|
||||
protected async override void OnAppearing()
|
||||
{
|
||||
if(_requireAuth && !_authService.IsAuthenticated)
|
||||
{
|
||||
@ -52,6 +52,7 @@ namespace Bit.App.Controls
|
||||
}
|
||||
|
||||
_googleAnalyticsService.TrackPage(GetType().Name);
|
||||
await _lockService.CheckLockAsync(false, true);
|
||||
base.OnAppearing();
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ namespace Bit.App.Services
|
||||
_stopwatch?.Restart();
|
||||
}
|
||||
|
||||
public async Task<LockType> GetLockTypeAsync(bool forceLock)
|
||||
public async Task<LockType> GetLockTypeAsync(bool forceLock, bool onlyIfAlreadyLocked = false)
|
||||
{
|
||||
// Only lock if they are logged in
|
||||
if(!_authService.IsAuthenticated)
|
||||
@ -59,6 +59,11 @@ namespace Bit.App.Services
|
||||
}
|
||||
}
|
||||
|
||||
if(onlyIfAlreadyLocked && !_appSettings.Locked)
|
||||
{
|
||||
return LockType.None;
|
||||
}
|
||||
|
||||
// What method are we using to unlock?
|
||||
var fingerprintUnlock = _settings.GetValueOrDefault(Constants.SettingFingerprintUnlockOn, false);
|
||||
var pinUnlock = _settings.GetValueOrDefault(Constants.SettingPinUnlockOn, false);
|
||||
@ -77,14 +82,14 @@ namespace Bit.App.Services
|
||||
}
|
||||
}
|
||||
|
||||
public async Task CheckLockAsync(bool forceLock)
|
||||
public async Task CheckLockAsync(bool forceLock, bool onlyIfAlreadyLocked = false)
|
||||
{
|
||||
if(TopPageIsLock())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var lockType = await GetLockTypeAsync(forceLock);
|
||||
var lockType = await GetLockTypeAsync(forceLock, onlyIfAlreadyLocked);
|
||||
if(lockType == LockType.None)
|
||||
{
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user