mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 15:15:34 +03:00
fix settings
This commit is contained in:
parent
9d491a3636
commit
d53bfae529
1 changed files with 11 additions and 12 deletions
|
@ -1,4 +1,7 @@
|
|||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Utilities;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -28,9 +31,15 @@ namespace Bit.Core.Services
|
|||
_settingsCache = null;
|
||||
}
|
||||
|
||||
public Task<List<List<string>>> GetEquivalentDomainsAsync()
|
||||
public async Task<List<List<string>>> GetEquivalentDomainsAsync()
|
||||
{
|
||||
return GetSettingsKeyAsync<List<List<string>>>(Keys_EquivalentDomains);
|
||||
var settings = await GetSettingsAsync();
|
||||
if(settings != null && settings.ContainsKey(Keys_EquivalentDomains))
|
||||
{
|
||||
var jArray = (settings[Keys_EquivalentDomains] as JArray);
|
||||
return jArray.ToObject<List<List<string>>>();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Task SetEquivalentDomainsAsync(List<List<string>> equivalentDomains)
|
||||
|
@ -57,16 +66,6 @@ namespace Bit.Core.Services
|
|||
return _settingsCache;
|
||||
}
|
||||
|
||||
private async Task<T> GetSettingsKeyAsync<T>(string key)
|
||||
{
|
||||
var settings = await GetSettingsAsync();
|
||||
if(settings != null && settings.ContainsKey(key))
|
||||
{
|
||||
return (T)settings[key];
|
||||
}
|
||||
return (T)(object)null;
|
||||
}
|
||||
|
||||
private async Task SetSettingsKeyAsync<T>(string key, T value)
|
||||
{
|
||||
var userId = await _userService.GetUserIdAsync();
|
||||
|
|
Loading…
Reference in a new issue