Add initial mail sync range selection

This commit is contained in:
Burak Kaan Köse
2026-04-14 00:03:48 +02:00
parent 2e36772a4c
commit c622858d2d
21 changed files with 378 additions and 73 deletions
+5
View File
@@ -590,6 +590,11 @@ public class AccountService : BaseDatabaseService, IAccountService
{
Guard.IsNotNull(account);
if (!account.CreatedAt.HasValue)
{
account.CreatedAt = DateTime.UtcNow;
}
var accountCount = await Connection.Table<MailAccount>().CountAsync();
// If there are no accounts before this one, set it as startup account.
+16
View File
@@ -79,6 +79,22 @@ public class DatabaseService : IDatabaseService
{
await EnsureKeyboardShortcutSchemaAsync().ConfigureAwait(false);
var accountColumns = await Connection.GetTableInfoAsync(nameof(MailAccount)).ConfigureAwait(false);
if (!accountColumns.Any(c => c.Name == nameof(MailAccount.CreatedAt)))
{
await Connection
.ExecuteAsync($"ALTER TABLE {nameof(MailAccount)} ADD COLUMN {nameof(MailAccount.CreatedAt)} TEXT NULL")
.ConfigureAwait(false);
}
if (!accountColumns.Any(c => c.Name == nameof(MailAccount.InitialSynchronizationRange)))
{
await Connection
.ExecuteAsync($"ALTER TABLE {nameof(MailAccount)} ADD COLUMN {nameof(MailAccount.InitialSynchronizationRange)} INTEGER NOT NULL DEFAULT {(int)InitialSynchronizationRange.SixMonths}")
.ConfigureAwait(false);
}
var folderColumns = await Connection.GetTableInfoAsync(nameof(MailItemFolder)).ConfigureAwait(false);
if (!folderColumns.Any(c => c.Name == nameof(MailItemFolder.HighestKnownUid)))
@@ -211,6 +211,8 @@ public sealed class WinoAccountDataSyncService : IWinoAccountDataSyncService
SpecialImapProvider = (SpecialImapProvider)mailbox.SpecialImapProvider,
AccountColorHex = mailbox.AccountColorHex?.Trim(),
Base64ProfilePictureData = string.Empty,
CreatedAt = DateTime.UtcNow,
InitialSynchronizationRange = InitialSynchronizationRange.SixMonths,
IsCalendarAccessGranted = mailbox.IsCalendarAccessGranted,
SynchronizationDeltaIdentifier = string.Empty,
CalendarSynchronizationDeltaIdentifier = string.Empty,