Add initial mail sync range selection
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user