1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-06 10:34:07 +00:00

[SG-79] Mobile Vault Filter (#1928)

* [SG-79] Vault Filter

* Update vault button text after sync

* formatting

* cleanup

* cleanup
This commit is contained in:
mp-bw
2022-05-31 13:34:54 -04:00
committed by GitHub
parent b8b41fe847
commit 8a3d88b3ce
13 changed files with 261 additions and 25 deletions

View File

@@ -107,9 +107,12 @@ namespace Bit.Core.Services
return _decryptedFolderCache;
}
public async Task<List<TreeNode<FolderView>>> GetAllNestedAsync()
public async Task<List<TreeNode<FolderView>>> GetAllNestedAsync(List<FolderView> folders = null)
{
var folders = await GetAllDecryptedAsync();
if (folders == null)
{
folders = await GetAllDecryptedAsync();
}
var nodes = new List<TreeNode<FolderView>>();
foreach (var f in folders)
{

View File

@@ -193,7 +193,8 @@ namespace Bit.Core.Services
return new Tuple<ResetPasswordPolicyOptions, bool>(resetPasswordPolicyOptions, policy != null);
}
public async Task<bool> PolicyAppliesToUser(PolicyType policyType, Func<Policy, bool> policyFilter, string userId = null)
public async Task<bool> PolicyAppliesToUser(PolicyType policyType, Func<Policy, bool> policyFilter = null,
string userId = null)
{
var policies = await GetAll(policyType, userId);
if (policies == null)
@@ -246,6 +247,13 @@ namespace Bit.Core.Services
return null;
}
public async Task<bool> ShouldShowVaultFilterAsync()
{
var organizations = await _organizationService.GetAllAsync();
var personalOwnershipPolicyApplies = await PolicyAppliesToUser(PolicyType.PersonalOwnership);
return (organizations?.Any() ?? false) && !personalOwnershipPolicyApplies;
}
private bool? GetPolicyBool(Policy policy, string key)
{
if (policy.Data.ContainsKey(key))