mirror of
https://github.com/bitwarden/mobile
synced 2025-12-17 16:53:26 +00:00
[PS-1809] Updating the account premium state when syncing the vault (#2290)
* [PS-1809] Updating the account premium state when syncing the vault * [PS-1809] Added validation to check if HasPremiumPersonally needs to be updated * PS-1809 Renamed SetPremiumAsync to SetPersonalPremiumAsync
This commit is contained in:
@@ -291,6 +291,20 @@ namespace Bit.Core.Services
|
||||
return organizations?.Any(o => o.UsersGetPremium && o.Enabled) ?? false;
|
||||
}
|
||||
|
||||
public async Task SetPersonalPremiumAsync(bool value, string userId = null)
|
||||
{
|
||||
var reconciledOptions = ReconcileOptions(new StorageOptions { UserId = userId },
|
||||
await GetDefaultStorageOptionsAsync());
|
||||
var account = await GetAccountAsync(reconciledOptions);
|
||||
if (account?.Profile == null || account.Profile.HasPremiumPersonally.GetValueOrDefault() == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
account.Profile.HasPremiumPersonally = value;
|
||||
await SaveAccountAsync(account, reconciledOptions);
|
||||
}
|
||||
|
||||
public async Task<string> GetProtectedPinAsync(string userId = null)
|
||||
{
|
||||
var reconciledOptions = ReconcileOptions(new StorageOptions { UserId = userId },
|
||||
|
||||
Reference in New Issue
Block a user