mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 10:28:28 +03:00
[SG-390] Fix for missing org items with single org & personal ownership enabled (#1953)
* fix for missing org items with single org & personal ownership enabled * fix for ui issue with vault filter state change on pull to refresh
This commit is contained in:
parent
448758a697
commit
c53a85cd50
1 changed files with 13 additions and 7 deletions
|
@ -19,7 +19,7 @@ namespace Bit.App.Pages
|
|||
protected abstract ILogger logger { get; }
|
||||
|
||||
protected bool _showVaultFilter;
|
||||
protected bool _hideMyVaultFilterOption;
|
||||
protected bool _personalOwnershipPolicyApplies;
|
||||
protected string _vaultFilterSelection;
|
||||
protected List<Organization> _organizations;
|
||||
|
||||
|
@ -64,15 +64,21 @@ namespace Bit.App.Pages
|
|||
protected async Task InitVaultFilterAsync()
|
||||
{
|
||||
_organizations = await organizationService.GetAllAsync();
|
||||
if (_organizations?.Any() ?? false)
|
||||
{
|
||||
_personalOwnershipPolicyApplies = await policyService.PolicyAppliesToUser(PolicyType.PersonalOwnership);
|
||||
var singleOrgPolicyApplies = await policyService.PolicyAppliesToUser(PolicyType.OnlyOrg);
|
||||
if (_personalOwnershipPolicyApplies && singleOrgPolicyApplies)
|
||||
{
|
||||
VaultFilterDescription = _organizations.First().Name;
|
||||
}
|
||||
else if (_vaultFilterSelection == null)
|
||||
{
|
||||
VaultFilterDescription = AppResources.AllVaults;
|
||||
}
|
||||
}
|
||||
await Task.Delay(100);
|
||||
ShowVaultFilter = await policyService.ShouldShowVaultFilterAsync();
|
||||
if (ShowVaultFilter)
|
||||
{
|
||||
_hideMyVaultFilterOption = await policyService.PolicyAppliesToUser(PolicyType.PersonalOwnership);
|
||||
if (_vaultFilterSelection == null)
|
||||
{
|
||||
_vaultFilterSelection = AppResources.AllVaults;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task<List<CipherView>> GetAllCiphersAsync()
|
||||
|
@ -93,7 +99,7 @@ namespace Bit.App.Pages
|
|||
protected async Task VaultFilterOptionsAsync()
|
||||
{
|
||||
var options = new List<string> { AppResources.AllVaults };
|
||||
if (!_hideMyVaultFilterOption)
|
||||
if (!_personalOwnershipPolicyApplies)
|
||||
{
|
||||
options.Add(AppResources.MyVault);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue