Cleaning up the solution. Separating Shared.WinRT, Services and Synchronization. Removing synchronization from app. Reducing bundle size by 45mb.

This commit is contained in:
Burak Kaan Köse
2024-07-21 05:45:02 +02:00
parent f112f369a7
commit 495885e006
523 changed files with 2254 additions and 2375 deletions

View File

@@ -0,0 +1,63 @@
using System;
using System.IO;
using System.Threading.Tasks;
using SQLite;
using Wino.Domain.Entities;
using Wino.Domain.Interfaces;
namespace Wino.Services.Services
{
public class DatabaseService : IDatabaseService
{
private const string DatabaseName = "Wino172.db";
private bool _isInitialized = false;
private readonly IApplicationConfiguration _folderConfiguration;
public SQLiteAsyncConnection Connection { get; private set; }
public DatabaseService(IApplicationConfiguration folderConfiguration)
{
_folderConfiguration = folderConfiguration;
}
public async Task InitializeAsync()
{
if (_isInitialized)
return;
var publisherCacheFolder = _folderConfiguration.PublisherSharedFolderPath;
var databaseFileName = Path.Combine(publisherCacheFolder, DatabaseName);
Connection = new SQLiteAsyncConnection(databaseFileName)
{
// Enable for debugging sqlite.
Trace = true,
Tracer = new Action<string>((t) =>
{
// Debug.WriteLine(t);
// Log.Debug(t);
})
};
await CreateTablesAsync();
_isInitialized = true;
}
private async Task CreateTablesAsync()
{
await Connection.CreateTablesAsync(CreateFlags.None,
typeof(MailCopy),
typeof(MailItemFolder),
typeof(MailAccount),
typeof(TokenInformation),
typeof(AddressInformation),
typeof(CustomServerInformation),
typeof(AccountSignature),
typeof(MergedInbox),
typeof(MailAccountPreferences)
);
}
}
}