From d53bfae5293e3fd131d1d2b9bc5be198352ed9fe Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 17 May 2019 13:10:07 -0400 Subject: [PATCH] fix settings --- src/Core/Services/SettingsService.cs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Core/Services/SettingsService.cs b/src/Core/Services/SettingsService.cs index 89176c907..e8804f4a8 100644 --- a/src/Core/Services/SettingsService.cs +++ b/src/Core/Services/SettingsService.cs @@ -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>> GetEquivalentDomainsAsync() + public async Task>> GetEquivalentDomainsAsync() { - return GetSettingsKeyAsync>>(Keys_EquivalentDomains); + var settings = await GetSettingsAsync(); + if(settings != null && settings.ContainsKey(Keys_EquivalentDomains)) + { + var jArray = (settings[Keys_EquivalentDomains] as JArray); + return jArray.ToObject>>(); + } + return null; } public Task SetEquivalentDomainsAsync(List> equivalentDomains) @@ -57,16 +66,6 @@ namespace Bit.Core.Services return _settingsCache; } - private async Task GetSettingsKeyAsync(string key) - { - var settings = await GetSettingsAsync(); - if(settings != null && settings.ContainsKey(key)) - { - return (T)settings[key]; - } - return (T)(object)null; - } - private async Task SetSettingsKeyAsync(string key, T value) { var userId = await _userService.GetUserIdAsync();