Online Search (#576)
* Very basic online search for gmail. * Server side of handling offline search and listing part in listing page. * Default search mode implementation and search UI improvements. * Online search for Outlook. * Very basic online search for gmail. * Server side of handling offline search and listing part in listing page. * Default search mode implementation and search UI improvements. * Online search for Outlook. * Online search for imap without downloading the messages yet. TODO * Completing imap search.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
using System.Text.Json.Serialization.Metadata;
|
||||
using MailKit;
|
||||
using Wino.Core.Domain.Entities.Mail;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
using Wino.Core.Domain.Models.Folders;
|
||||
using Wino.Core.Domain.Models.MailItem;
|
||||
using Wino.Core.Requests.Folder;
|
||||
using Wino.Core.Requests.Mail;
|
||||
@@ -45,7 +45,7 @@ public class ServerRequestTypeInfoResolver : DefaultJsonTypeInfoResolver
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (t.Type == typeof(IMailFolder))
|
||||
else if (t.Type == typeof(IMailItemFolder))
|
||||
{
|
||||
t.PolymorphismOptions = new JsonPolymorphismOptions()
|
||||
{
|
||||
|
||||
@@ -38,9 +38,17 @@ public interface IDefaultChangeProcessor
|
||||
Task<List<MailItemFolder>> GetSynchronizationFoldersAsync(MailSynchronizationOptions options);
|
||||
Task<bool> MapLocalDraftAsync(Guid accountId, Guid localDraftCopyUniqueId, string newMailCopyId, string newDraftId, string newThreadId);
|
||||
Task UpdateFolderLastSyncDateAsync(Guid folderId);
|
||||
Task<List<MailItemFolder>> GetExistingFoldersAsync(Guid accountId);
|
||||
Task UpdateRemoteAliasInformationAsync(MailAccount account, List<RemoteAccountAlias> remoteAccountAliases);
|
||||
|
||||
/// <summary>
|
||||
/// Interrupted initial synchronization may cause downloaded mails to be saved in the database twice.
|
||||
/// Since downloading mime is costly in Outlook, we need to check if the actual copy of the message has been saved before.
|
||||
/// This is also used in online search to prevent duplicate mails.
|
||||
/// </summary>
|
||||
/// <param name="messageId">MailCopyId of the message.</param>
|
||||
/// <returns>Whether mail exists or not.</returns>
|
||||
Task<bool> IsMailExistsAsync(string messageId);
|
||||
|
||||
// Calendar
|
||||
Task<List<AccountCalendar>> GetAccountCalendarsAsync(Guid accountId);
|
||||
|
||||
@@ -51,6 +59,8 @@ public interface IDefaultChangeProcessor
|
||||
Task UpdateAccountCalendarAsync(AccountCalendar accountCalendar);
|
||||
|
||||
Task UpdateCalendarDeltaSynchronizationToken(Guid calendarId, string deltaToken);
|
||||
Task<MailCopy> GetMailCopyAsync(string mailCopyId);
|
||||
Task CreateMailRawAsync(MailAccount account, MailItemFolder mailItemFolder, NewMailItemPackage package);
|
||||
}
|
||||
|
||||
public interface IGmailChangeProcessor : IDefaultChangeProcessor
|
||||
@@ -62,14 +72,6 @@ public interface IGmailChangeProcessor : IDefaultChangeProcessor
|
||||
|
||||
public interface IOutlookChangeProcessor : IDefaultChangeProcessor
|
||||
{
|
||||
/// <summary>
|
||||
/// Interrupted initial synchronization may cause downloaded mails to be saved in the database twice.
|
||||
/// Since downloading mime is costly in Outlook, we need to check if the actual copy of the message has been saved before.
|
||||
/// </summary>
|
||||
/// <param name="messageId">MailCopyId of the message.</param>
|
||||
/// <returns>Whether the mime has b</returns>
|
||||
Task<bool> IsMailExistsAsync(string messageId);
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether the mail exists in the folder.
|
||||
/// When deciding Create or Update existing mail, we need to check if the mail exists in the folder.
|
||||
@@ -141,22 +143,26 @@ public class DefaultChangeProcessor(IDatabaseService databaseService,
|
||||
public Task ChangeFlagStatusAsync(string mailCopyId, bool isFlagged)
|
||||
=> MailService.ChangeFlagStatusAsync(mailCopyId, isFlagged);
|
||||
|
||||
public Task<bool> IsMailExistsAsync(string messageId)
|
||||
=> MailService.IsMailExistsAsync(messageId);
|
||||
|
||||
public Task<MailCopy> GetMailCopyAsync(string mailCopyId)
|
||||
=> MailService.GetSingleMailItemAsync(mailCopyId);
|
||||
|
||||
public Task ChangeMailReadStatusAsync(string mailCopyId, bool isRead)
|
||||
=> MailService.ChangeReadStatusAsync(mailCopyId, isRead);
|
||||
|
||||
public Task DeleteAssignmentAsync(Guid accountId, string mailCopyId, string remoteFolderId)
|
||||
=> MailService.DeleteAssignmentAsync(accountId, mailCopyId, remoteFolderId);
|
||||
|
||||
|
||||
|
||||
public Task DeleteMailAsync(Guid accountId, string mailId)
|
||||
=> MailService.DeleteMailAsync(accountId, mailId);
|
||||
|
||||
public Task<bool> CreateMailAsync(Guid accountId, NewMailItemPackage package)
|
||||
=> MailService.CreateMailAsync(accountId, package);
|
||||
|
||||
public Task<List<MailItemFolder>> GetExistingFoldersAsync(Guid accountId)
|
||||
=> FolderService.GetFoldersAsync(accountId);
|
||||
public Task CreateMailRawAsync(MailAccount account, MailItemFolder mailItemFolder, NewMailItemPackage package)
|
||||
=> MailService.CreateMailRawAsync(account, mailItemFolder, package);
|
||||
|
||||
public Task<bool> MapLocalDraftAsync(Guid accountId, Guid localDraftCopyUniqueId, string newMailCopyId, string newDraftId, string newThreadId)
|
||||
=> MailService.MapLocalDraftAsync(accountId, localDraftCopyUniqueId, newMailCopyId, newDraftId, newThreadId);
|
||||
|
||||
@@ -20,8 +20,6 @@ public class OutlookChangeProcessor(IDatabaseService databaseService,
|
||||
IMimeFileService mimeFileService) : DefaultChangeProcessor(databaseService, folderService, mailService, calendarService, accountService, mimeFileService)
|
||||
, IOutlookChangeProcessor
|
||||
{
|
||||
public Task<bool> IsMailExistsAsync(string messageId)
|
||||
=> MailService.IsMailExistsAsync(messageId);
|
||||
|
||||
public Task<bool> IsMailExistsInFolderAsync(string messageId, Guid folderId)
|
||||
=> MailService.IsMailExistsAsync(messageId, folderId);
|
||||
|
||||
Reference in New Issue
Block a user