mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 02:18:27 +03:00
[PM-1567] Fix for vault timeout 'never' not persisting (#2440)
This commit is contained in:
parent
3e76f6b054
commit
80e38f8669
1 changed files with 10 additions and 3 deletions
|
@ -526,8 +526,7 @@ namespace Bit.Core.Services
|
||||||
{
|
{
|
||||||
var reconciledOptions = ReconcileOptions(new StorageOptions { UserId = userId },
|
var reconciledOptions = ReconcileOptions(new StorageOptions { UserId = userId },
|
||||||
await GetDefaultStorageOptionsAsync());
|
await GetDefaultStorageOptionsAsync());
|
||||||
return await GetValueAsync<int?>(Constants.VaultTimeoutKey(reconciledOptions.UserId), reconciledOptions) ??
|
return await GetValueAsync<int?>(Constants.VaultTimeoutKey(reconciledOptions.UserId), reconciledOptions);
|
||||||
Constants.VaultTimeoutDefault;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SetVaultTimeoutAsync(int? value, string userId = null)
|
public async Task SetVaultTimeoutAsync(int? value, string userId = null)
|
||||||
|
@ -542,7 +541,7 @@ namespace Bit.Core.Services
|
||||||
var reconciledOptions = ReconcileOptions(new StorageOptions { UserId = userId },
|
var reconciledOptions = ReconcileOptions(new StorageOptions { UserId = userId },
|
||||||
await GetDefaultStorageOptionsAsync());
|
await GetDefaultStorageOptionsAsync());
|
||||||
return await GetValueAsync<VaultTimeoutAction?>(Constants.VaultTimeoutActionKey(reconciledOptions.UserId),
|
return await GetValueAsync<VaultTimeoutAction?>(Constants.VaultTimeoutActionKey(reconciledOptions.UserId),
|
||||||
reconciledOptions) ?? VaultTimeoutAction.Lock;
|
reconciledOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SetVaultTimeoutActionAsync(VaultTimeoutAction? value, string userId = null)
|
public async Task SetVaultTimeoutActionAsync(VaultTimeoutAction? value, string userId = null)
|
||||||
|
@ -1444,6 +1443,14 @@ namespace Bit.Core.Services
|
||||||
}
|
}
|
||||||
_state.Accounts[account.Profile.UserId] = account;
|
_state.Accounts[account.Profile.UserId] = account;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if account has logged in before by checking a guaranteed non-null pref
|
||||||
|
if (await GetVaultTimeoutActionAsync(account.Profile.UserId) == null)
|
||||||
|
{
|
||||||
|
// Account has never logged in, set defaults
|
||||||
|
await SetVaultTimeoutAsync(Constants.VaultTimeoutDefault, account.Profile.UserId);
|
||||||
|
await SetVaultTimeoutActionAsync(VaultTimeoutAction.Lock, account.Profile.UserId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private StorageOptions ReconcileOptions(StorageOptions requestedOptions, StorageOptions defaultOptions)
|
private StorageOptions ReconcileOptions(StorageOptions requestedOptions, StorageOptions defaultOptions)
|
||||||
|
|
Loading…
Reference in a new issue