IMAP Improvements (#558)

* Fixing an issue where scrollviewer overrides a part of template in mail list. Adjusted zoomed out header grid's corner radius.

* IDLE implementation, imap synchronization strategies basics and condstore synchronization.

* Adding iCloud and Yahoo as special IMAP handling scenario.

* iCloud special imap handling.

* Support for killing synchronizers.

* Update privacy policy url.

* Batching condstore downloads into 50, using SORT extension for searches if supported.

* Bumping some nugets. More on the imap synchronizers.

* Delegating idle synchronizations to server to post-sync operations.

* Update mailkit to resolve qresync bug with iCloud.

* Fixing remote highest mode seq checks for qresync and condstore synchronizers.

* Yahoo custom settings.

* Bump google sdk package.

* Fixing the build issue....

* NRE on canceled token accounts during setup.

* Server crash handlers.

* Remove ARM32. Upgrade server to .NET 9.

* Fix icons for yahoo and apple.

* Fixed an issue where disabled folders causing an exception on forced sync.

* Remove smtp encoding constraint.

* Remove commented code.

* Fixing merge conflict

* Addressing double registrations for mailkit remote folder events in synchronizers.

* Making sure idle canceled result is not reported.

* Fixing custom imap server dialog opening.

* Fixing the issue with account creation making the previously selected account as selected as well.

* Fixing app close behavior and logging app close.
This commit is contained in:
Burak Kaan Köse
2025-02-15 12:53:32 +01:00
committed by GitHub
parent 30f1257983
commit ee9e41c5a7
108 changed files with 2092 additions and 1166 deletions

View File

@@ -1,11 +1,12 @@
using System.Threading;
using System.Threading.Tasks;
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Interfaces
{
public interface IAccountCreationDialog
{
void ShowDialog(CancellationTokenSource cancellationTokenSource);
Task ShowDialogAsync(CancellationTokenSource cancellationTokenSource);
void Complete(bool cancel);
AccountCreationDialogState State { get; set; }
}

View File

@@ -23,12 +23,6 @@ namespace Wino.Core.Domain.Interfaces
/// <param name="request">Request to queue.</param>
void QueueRequest(IRequestBase request);
/// <summary>
/// TODO
/// </summary>
/// <returns>Whether active synchronization is stopped or not.</returns>
bool CancelActiveSynchronization();
/// <summary>
/// Synchronizes profile information with the server.
/// Sender name and Profile picture are updated.

View File

@@ -13,5 +13,10 @@ namespace Wino.Core.Domain.Interfaces
/// Which folders to sync after this operation?
/// </summary>
List<Guid> SynchronizationFolderIds { get; }
/// <summary>
/// If true, additional folders like Sent, Drafts and Deleted will not be synchronized
/// </summary>
bool ExcludeMustHaveFolders { get; }
}
}

View File

@@ -27,7 +27,7 @@ namespace Wino.Core.Domain.Interfaces
string dontAskAgainConfigurationKey = "");
Task<bool> ShowCustomThemeBuilderDialogAsync();
Task<AccountCreationDialogResult> ShowAccountProviderSelectionDialogAsync(List<IProviderDetail> availableProviders);
IAccountCreationDialog GetAccountCreationDialog(MailProviderType type);
IAccountCreationDialog GetAccountCreationDialog(AccountCreationDialogResult accountCreationDialogResult);
Task<List<SharedFile>> PickFilesAsync(params object[] typeFilters);
Task<string> PickFilePathAsync(string saveFileName);
}

View File

@@ -3,7 +3,7 @@ using Wino.Core.Domain.Entities.Shared;
namespace Wino.Core.Domain.Interfaces
{
public interface ICustomServerAccountCreationDialog : IAccountCreationDialog
public interface IImapAccountCreationDialog : IAccountCreationDialog
{
/// <summary>
/// Returns the custom server information from the dialog..

View File

@@ -0,0 +1,12 @@
using MailKit.Net.Imap;
namespace Wino.Core.Domain.Interfaces
{
/// <summary>
/// Provides a synchronization strategy for synchronizing IMAP folders based on the server capabilities.
/// </summary>
public interface IImapSynchronizationStrategyProvider
{
IImapSynchronizerStrategy GetSynchronizationStrategy(IImapClient client);
}
}

View File

@@ -0,0 +1,17 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Wino.Core.Domain.Entities.Mail;
using Wino.Core.Domain.Models.MailItem;
namespace Wino.Core.Domain.Interfaces
{
public interface IImapSynchronizer
{
uint InitialMessageDownloadCountPerFolder { get; }
Task<List<NewMailItemPackage>> CreateNewMailPackagesAsync(ImapMessageCreationPackage message, MailItemFolder assignedFolder, CancellationToken cancellationToken = default);
Task StartIdleClientAsync();
Task StopIdleClientAsync();
}
}

View File

@@ -0,0 +1,22 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MailKit.Net.Imap;
using Wino.Core.Domain.Entities.Mail;
namespace Wino.Core.Domain.Interfaces
{
public interface IImapSynchronizerStrategy
{
/// <summary>
/// Synchronizes given folder with the ImapClient client from the client pool.
/// </summary>
/// <param name="client">Client to perform sync with. I love Mira and Jasminka</param>
/// <param name="folder">Folder to synchronize.</param>
/// <param name="synchronizer">Imap synchronizer that downloads messages.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>List of new downloaded message ids that don't exist locally.</returns>
Task<List<string>> HandleSynchronizationAsync(IImapClient client, MailItemFolder folder, IImapSynchronizer synchronizer, CancellationToken cancellationToken = default);
}
}

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MailKit;
using Wino.Core.Domain.Entities.Mail;
using Wino.Core.Domain.Entities.Shared;
using Wino.Core.Domain.Models.MailItem;
@@ -108,5 +109,13 @@ namespace Wino.Core.Domain.Interfaces
/// <param name="draftCreationOptions">Options like new email/forward/draft.</param>
/// <returns>Draft MailCopy and Draft MimeMessage as base64.</returns>
Task<(MailCopy draftMailCopy, string draftBase64MimeMessage)> CreateDraftAsync(Guid accountId, DraftCreationOptions draftCreationOptions);
/// <summary>
/// Returns ids
/// </summary>
/// <param name="folderId"></param>
/// <param name="uniqueIds"></param>
/// <returns></returns>
Task<List<MailCopy>> GetExistingMailsAsync(Guid folderId, IEnumerable<UniqueId> uniqueIds);
}
}

View File

@@ -5,6 +5,7 @@ namespace Wino.Core.Domain.Interfaces
public interface IProviderDetail
{
MailProviderType Type { get; }
SpecialImapProvider SpecialImapProvider { get; }
string Name { get; }
string Description { get; }
string ProviderImage { get; }

View File

@@ -0,0 +1,10 @@
using Wino.Core.Domain.Entities.Shared;
using Wino.Core.Domain.Models.Accounts;
namespace Wino.Core.Domain.Interfaces
{
public interface ISpecialImapProviderConfigResolver
{
CustomServerInformation GetServerInformation(MailAccount account, AccountCreationDialogResult dialogResult);
}
}

View File

@@ -7,5 +7,6 @@ namespace Wino.Core.Domain.Interfaces
{
Task<IWinoSynchronizerBase> GetAccountSynchronizerAsync(Guid accountId);
Task InitializeAsync();
Task DeleteSynchronizerAsync(Guid accountId);
}
}

View File

@@ -28,5 +28,12 @@ namespace Wino.Core.Domain.Interfaces
/// <param name="transferProgress">Optional progress reporting for download operation.</param>
/// <param name="cancellationToken">Cancellation token.</param>
Task DownloadMissingMimeMessageAsync(IMailItem mailItem, ITransferProgress transferProgress, CancellationToken cancellationToken = default);
/// <summary>
/// 1. Cancel active synchronization.
/// 2. Stop all running tasks.
/// 3. Dispose all resources.
/// </summary>
Task KillSynchronizerAsync();
}
}