1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-15 15:53:44 +00:00

Supress lock and logout when showing fileswitcher on Android (#1626)

* Supress lock and logout when showing fileswitcher on Android

* convert suppress bool to delay long
- move HandleVaultTimeoutAsync to vaultTimeoutService
This commit is contained in:
Jake Fink
2022-01-19 09:09:30 -05:00
committed by GitHub
parent 2791d4b8ec
commit 6f3999016f
4 changed files with 36 additions and 38 deletions

View File

@@ -176,6 +176,8 @@ namespace Bit.App
if (Device.RuntimePlatform == Device.Android)
{
await _vaultTimeoutService.CheckVaultTimeoutAsync();
// Reset delay on every start
_vaultTimeoutService.DelayLockAndLogoutMs = null;
}
_messagingService.Send("startEventTimer");
}
@@ -208,7 +210,7 @@ namespace Bit.App
private async Task SleptAsync()
{
await HandleVaultTimeoutAsync();
await _vaultTimeoutService.CheckVaultTimeoutAsync();
_messagingService.Send("stopEventTimer");
}
@@ -279,33 +281,6 @@ namespace Bit.App
}
}
private async Task HandleVaultTimeoutAsync()
{
if (await _vaultTimeoutService.IsLockedAsync())
{
return;
}
var authed = await _userService.IsAuthenticatedAsync();
if (!authed)
{
return;
}
var vaultTimeout = await _storageService.GetAsync<int?>(Constants.VaultTimeoutKey);
vaultTimeout = vaultTimeout.GetValueOrDefault(-1);
if (vaultTimeout == 0)
{
var action = await _storageService.GetAsync<string>(Constants.VaultTimeoutActionKey);
if (action == "logOut")
{
await _vaultTimeoutService.LogOutAsync();
}
else
{
await _vaultTimeoutService.LockAsync(true);
}
}
}
private async Task ClearCacheIfNeededAsync()
{
var lastClear = await _storageService.GetAsync<DateTime?>(Constants.LastFileCacheClearKey);