1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-18 09:13:15 +00:00

Support for lock/logout/remove accounts from account list (#1826)

* Support for lock/logout/remove accounts via long-press

* establish and set listview height before showing

* undo modification
This commit is contained in:
Matt Portune
2022-03-07 12:28:06 -05:00
committed by GitHub
parent efd83d07dd
commit 79a76c4638
24 changed files with 342 additions and 69 deletions

View File

@@ -42,6 +42,16 @@ namespace Bit.Core.Services
return activeUserId;
}
public async Task<bool> IsActiveAccount(string userId = null)
{
if (userId == null)
{
return true;
}
await CheckStateAsync();
return userId == await GetActiveUserIdAsync();
}
public async Task SetActiveUserAsync(string userId)
{
if (userId != null)
@@ -110,18 +120,16 @@ namespace Bit.Core.Services
{
var isActiveAccount = account.Profile.UserId == _state.ActiveUserId;
var accountView = new AccountView(account, isActiveAccount);
if (isActiveAccount)
if (await vaultTimeoutService.IsLoggedOutByTimeoutAsync(accountView.UserId) ||
await vaultTimeoutService.ShouldLogOutByTimeoutAsync(accountView.UserId))
{
AccountViews.Add(accountView);
continue;
accountView.AuthStatus = AuthenticationStatus.LoggedOut;
}
var isLocked = await vaultTimeoutService.IsLockedAsync(accountView.UserId);
var shouldTimeout = await vaultTimeoutService.ShouldTimeoutAsync(accountView.UserId);
if (isLocked || shouldTimeout)
else if (await vaultTimeoutService.IsLockedAsync(accountView.UserId) ||
await vaultTimeoutService.ShouldLockAsync(accountView.UserId))
{
var action = account.Settings.VaultTimeoutAction;
accountView.AuthStatus = action == VaultTimeoutAction.Logout ? AuthenticationStatus.LoggedOut
: AuthenticationStatus.Locked;
accountView.AuthStatus = AuthenticationStatus.Locked;
}
else
{