mirror of
https://github.com/bitwarden/android.git
synced 2024-11-01 15:45:42 +03:00
31 lines
1 KiB
C#
31 lines
1 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using Bit.App.Abstractions;
|
|||
|
using Bit.App.Models.Data;
|
|||
|
using Newtonsoft.Json;
|
|||
|
|
|||
|
namespace Bit.App.Repositories
|
|||
|
{
|
|||
|
public class SettingsRepository : Repository<SettingsData, string>, ISettingsRepository
|
|||
|
{
|
|||
|
public SettingsRepository(ISqlService sqlService)
|
|||
|
: base(sqlService)
|
|||
|
{ }
|
|||
|
|
|||
|
public Task<IEnumerable<IEnumerable<string>>> GetEquivablentDomains(string userId)
|
|||
|
{
|
|||
|
var equivalentDomainsJson = Connection.Table<SettingsData>().Where(f => f.Id == userId)
|
|||
|
.Select(f => f.EquivalentDomains).FirstOrDefault();
|
|||
|
|
|||
|
if(string.IsNullOrWhiteSpace(equivalentDomainsJson))
|
|||
|
{
|
|||
|
return Task.FromResult<IEnumerable<IEnumerable<string>>>(null);
|
|||
|
}
|
|||
|
|
|||
|
var equivalentDomains = JsonConvert.DeserializeObject<IEnumerable<IEnumerable<string>>>(equivalentDomainsJson);
|
|||
|
return Task.FromResult(equivalentDomains);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|