Mail queues.
This commit is contained in:
@@ -59,7 +59,8 @@ public class DatabaseService : IDatabaseService
|
||||
typeof(CalendarItem),
|
||||
typeof(Reminder),
|
||||
typeof(Thumbnail),
|
||||
typeof(KeyboardShortcut)
|
||||
typeof(KeyboardShortcut),
|
||||
typeof(MailItemQueue)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -697,6 +697,11 @@ public class MailService : BaseDatabaseService, IMailService
|
||||
await Task.WhenAll(mimeSaveTask, contactSaveTask, insertMailTask).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task CreateMailAsyncEx(Guid accountId, NewMailItemPackage package)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public async Task<bool> CreateMailAsync(Guid accountId, NewMailItemPackage package)
|
||||
{
|
||||
var account = await _accountService.GetAccountAsync(accountId).ConfigureAwait(false);
|
||||
@@ -784,6 +789,43 @@ public class MailService : BaseDatabaseService, IMailService
|
||||
}
|
||||
}
|
||||
|
||||
#region Mail Queue
|
||||
|
||||
public Task ClearMailItemQueueAsync(Guid accountId)
|
||||
=> Connection.ExecuteAsync("DELETE FROM MailItemQueue WHERE AccountId = ?", accountId);
|
||||
|
||||
public Task<int> GetMailItemQueueCountAsync(Guid accountId)
|
||||
=> Connection.Table<MailItemQueue>().Where(a => a.AccountId == accountId).CountAsync();
|
||||
|
||||
public Task UpdateMailItemQueueAsync(IEnumerable<MailItemQueue> queueItems)
|
||||
{
|
||||
if (queueItems == null || !queueItems.Any())
|
||||
return Task.CompletedTask;
|
||||
|
||||
return Connection.UpdateAllAsync(queueItems);
|
||||
}
|
||||
|
||||
public Task AddMailItemQueueItemsAsync(IEnumerable<MailItemQueue> queueItems)
|
||||
{
|
||||
if (queueItems == null || !queueItems.Any())
|
||||
return Task.CompletedTask;
|
||||
|
||||
return Connection.InsertAllAsync(queueItems);
|
||||
}
|
||||
|
||||
public Task<List<MailItemQueue>> GetMailItemQueueAsync(Guid accountId, int take)
|
||||
{
|
||||
// Skip not needed. Items are removed as they are processed.
|
||||
|
||||
return Connection.Table<MailItemQueue>()
|
||||
.Where(a => a.AccountId == accountId && !a.IsProcessed)
|
||||
.OrderBy(a => a.CreatedAt)
|
||||
.Take(take)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private async Task<MimeMessage> CreateDraftMimeAsync(MailAccount account, DraftCreationOptions draftCreationOptions)
|
||||
{
|
||||
// This unique id is stored in mime headers for Wino to identify remote message with local copy.
|
||||
|
||||
Reference in New Issue
Block a user