Cleaning up the solution. Separating Shared.WinRT, Services and Synchronization. Removing synchronization from app. Reducing bundle size by 45mb.
This commit is contained in:
26
Wino.Services/Services/TokenService.cs
Normal file
26
Wino.Services/Services/TokenService.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Wino.Domain.Entities;
|
||||
using Wino.Domain.Interfaces;
|
||||
|
||||
namespace Wino.Services.Services
|
||||
{
|
||||
public class TokenService : BaseDatabaseService, ITokenService
|
||||
{
|
||||
public TokenService(IDatabaseService databaseService) : base(databaseService) { }
|
||||
|
||||
public Task<TokenInformation> GetTokenInformationAsync(Guid accountId)
|
||||
=> Connection.Table<TokenInformation>().FirstOrDefaultAsync(a => a.AccountId == accountId);
|
||||
|
||||
public async Task SaveTokenInformationAsync(Guid accountId, TokenInformation tokenInformation)
|
||||
{
|
||||
// Delete all tokens for this account.
|
||||
await Connection.Table<TokenInformation>().DeleteAsync(a => a.AccountId == accountId);
|
||||
|
||||
// Save new token info to the account.
|
||||
tokenInformation.AccountId = accountId;
|
||||
|
||||
await Connection.InsertOrReplaceAsync(tokenInformation);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user