mirror of
https://github.com/bitwarden/android.git
synced 2024-12-20 08:12:26 +03:00
Do not record LastActivityDate on sleep if currently viewing a lock page on android
This commit is contained in:
parent
d4f52bce2b
commit
6cec61dc42
1 changed files with 28 additions and 9 deletions
|
@ -94,7 +94,7 @@ namespace Bit.App
|
|||
// Handle when your app sleeps
|
||||
Debug.WriteLine("OnSleep");
|
||||
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.OS == TargetPlatform.Android && !TopPageIsLock())
|
||||
{
|
||||
_settings.AddOrUpdateValue(Constants.LastActivityDate, DateTime.UtcNow);
|
||||
}
|
||||
|
@ -214,15 +214,18 @@ namespace Bit.App
|
|||
|
||||
private async Task CheckLockAsync(bool forceLock)
|
||||
{
|
||||
if(TopPageIsLock())
|
||||
{
|
||||
// already locked
|
||||
return;
|
||||
}
|
||||
|
||||
var lockType = _lockService.GetLockType(forceLock);
|
||||
var currentPage = Current.MainPage.Navigation.ModalStack.LastOrDefault() as ExtendedNavigationPage;
|
||||
switch(lockType)
|
||||
{
|
||||
case Enums.LockType.Fingerprint:
|
||||
if((currentPage?.CurrentPage as LockFingerprintPage) == null)
|
||||
{
|
||||
await Current.MainPage.Navigation.PushModalAsync(new ExtendedNavigationPage(new LockFingerprintPage(!forceLock)), false);
|
||||
}
|
||||
break;
|
||||
case Enums.LockType.PIN:
|
||||
var lockPinPage = (currentPage?.CurrentPage as LockPinPage);
|
||||
|
@ -234,16 +237,32 @@ namespace Bit.App
|
|||
}
|
||||
break;
|
||||
case Enums.LockType.Password:
|
||||
if((currentPage?.CurrentPage as LockPasswordPage) == null)
|
||||
{
|
||||
await Current.MainPage.Navigation.PushModalAsync(new ExtendedNavigationPage(new LockPasswordPage()), false);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private bool TopPageIsLock()
|
||||
{
|
||||
var currentPage = Current.MainPage.Navigation.ModalStack.LastOrDefault() as ExtendedNavigationPage;
|
||||
if((currentPage?.CurrentPage as LockFingerprintPage) != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if((currentPage?.CurrentPage as LockPinPage) != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if((currentPage?.CurrentPage as LockPasswordPage) != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void SetStyles()
|
||||
{
|
||||
var gray = Color.FromHex("333333");
|
||||
|
|
Loading…
Reference in a new issue