diff --git a/Wino.Core.Domain/Interfaces/IBaseCalendarSynchronizer.cs b/Wino.Core.Domain/Interfaces/IBaseCalendarSynchronizer.cs new file mode 100644 index 00000000..f88556df --- /dev/null +++ b/Wino.Core.Domain/Interfaces/IBaseCalendarSynchronizer.cs @@ -0,0 +1,7 @@ +namespace Wino.Core.Domain.Interfaces +{ + public interface IBaseCalendarSynchronizer : IBaseSynchronizer + { + + } +} diff --git a/Wino.Core.Domain/Interfaces/IBaseMailSynchronizer.cs b/Wino.Core.Domain/Interfaces/IBaseMailSynchronizer.cs new file mode 100644 index 00000000..87e7bd3a --- /dev/null +++ b/Wino.Core.Domain/Interfaces/IBaseMailSynchronizer.cs @@ -0,0 +1,30 @@ +using System.Threading; +using System.Threading.Tasks; +using MailKit; +using Wino.Core.Domain.Models.MailItem; +using Wino.Core.Domain.Models.Synchronization; + +namespace Wino.Core.Domain.Interfaces +{ + public interface IBaseMailSynchronizer : IBaseSynchronizer + { + /// + /// Performs a full synchronization with the server with given options. + /// This will also prepares batch requests for execution. + /// Requests are executed in the order they are queued and happens before the synchronization. + /// Result of the execution queue is processed during the synchronization. + /// + /// Options for synchronization. + /// Cancellation token. + /// Result summary of synchronization. + Task SynchronizeAsync(SynchronizationOptions options, CancellationToken cancellationToken = default); + + /// + /// Downloads a single MIME message from the server and saves it to disk. + /// + /// Mail item to download from server. + /// Optional progress reporting for download operation. + /// Cancellation token. + Task DownloadMissingMimeMessageAsync(IMailItem mailItem, ITransferProgress transferProgress, CancellationToken cancellationToken = default); + } +} diff --git a/Wino.Core.Domain/Interfaces/IBaseSynchronizer.cs b/Wino.Core.Domain/Interfaces/IBaseSynchronizer.cs index 9b1fec72..086f1e2a 100644 --- a/Wino.Core.Domain/Interfaces/IBaseSynchronizer.cs +++ b/Wino.Core.Domain/Interfaces/IBaseSynchronizer.cs @@ -1,15 +1,11 @@ -using System.Threading; -using System.Threading.Tasks; -using MailKit; +using System.Threading.Tasks; using Wino.Core.Domain.Entities.Shared; using Wino.Core.Domain.Enums; using Wino.Core.Domain.Models.Accounts; -using Wino.Core.Domain.Models.MailItem; -using Wino.Core.Domain.Models.Synchronization; namespace Wino.Core.Domain.Interfaces { - public interface IBaseMailSynchronizer + public interface IBaseSynchronizer { /// /// Account that is assigned for this synchronizer. @@ -33,30 +29,11 @@ namespace Wino.Core.Domain.Interfaces /// Whether active synchronization is stopped or not. bool CancelActiveSynchronization(); - /// - /// Performs a full synchronization with the server with given options. - /// This will also prepares batch requests for execution. - /// Requests are executed in the order they are queued and happens before the synchronization. - /// Result of the execution queue is processed during the synchronization. - /// - /// Options for synchronization. - /// Cancellation token. - /// Result summary of synchronization. - Task SynchronizeAsync(SynchronizationOptions options, CancellationToken cancellationToken = default); - /// /// Synchronizes profile information with the server. /// Sender name and Profile picture are updated. /// /// Profile information model that holds the values. Task GetProfileInformationAsync(); - - /// - /// Downloads a single MIME message from the server and saves it to disk. - /// - /// Mail item to download from server. - /// Optional progress reporting for download operation. - /// Cancellation token. - Task DownloadMissingMimeMessageAsync(IMailItem mailItem, ITransferProgress transferProgress, CancellationToken cancellationToken = default); } } diff --git a/Wino.Core/Integration/BaseCalendarIntegrator.cs b/Wino.Core/Integration/BaseCalendarIntegrator.cs deleted file mode 100644 index 33217d70..00000000 --- a/Wino.Core/Integration/BaseCalendarIntegrator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Threading.Tasks; - -namespace Wino.Core.Integration -{ - public abstract class BaseCalendarIntegrator - { - public abstract Task CreateCalendarEventAsync(TNativeRequestType request); - } -} diff --git a/Wino.Core/Synchronizers/BaseCalendarSynchronizer.cs b/Wino.Core/Synchronizers/BaseCalendarSynchronizer.cs new file mode 100644 index 00000000..0483667a --- /dev/null +++ b/Wino.Core/Synchronizers/BaseCalendarSynchronizer.cs @@ -0,0 +1,12 @@ +using Wino.Core.Domain.Entities.Shared; +using Wino.Core.Domain.Interfaces; + +namespace Wino.Core.Synchronizers +{ + public abstract class BaseCalendarSynchronizer : BaseSynchronizer, IBaseCalendarSynchronizer + { + protected BaseCalendarSynchronizer(MailAccount account) : base(account) + { + } + } +} diff --git a/Wino.Core/Synchronizers/BaseSynchronizer.cs b/Wino.Core/Synchronizers/BaseSynchronizer.cs index b837165a..b17f39ec 100644 --- a/Wino.Core/Synchronizers/BaseSynchronizer.cs +++ b/Wino.Core/Synchronizers/BaseSynchronizer.cs @@ -13,7 +13,7 @@ using Wino.Messaging.UI; namespace Wino.Core.Synchronizers { - public abstract class BaseSynchronizer + public abstract class BaseSynchronizer : IBaseSynchronizer { protected SemaphoreSlim synchronizationSemaphore = new(1); protected CancellationToken activeSynchronizationCancellationToken; @@ -38,7 +38,6 @@ namespace Wino.Core.Synchronizers Account = account; } - /// /// Queues a single request to be executed in the next synchronization. /// diff --git a/Wino.Core/Synchronizers/Calendar/BaseCalendarSynchronizer.cs b/Wino.Core/Synchronizers/Calendar/BaseCalendarSynchronizer.cs deleted file mode 100644 index eeb7bdfa..00000000 --- a/Wino.Core/Synchronizers/Calendar/BaseCalendarSynchronizer.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Wino.Core.Integration; - -namespace Wino.Core.Synchronizers.Calendar -{ - public abstract class BaseCalendarSynchronizer : BaseCalendarIntegrator - { - - } -} diff --git a/Wino.Core/Synchronizers/Calendar/OutlookCalendarSynchronizer.cs b/Wino.Core/Synchronizers/Calendar/OutlookCalendarSynchronizer.cs index e657c9c0..81879269 100644 --- a/Wino.Core/Synchronizers/Calendar/OutlookCalendarSynchronizer.cs +++ b/Wino.Core/Synchronizers/Calendar/OutlookCalendarSynchronizer.cs @@ -1,21 +1,20 @@ using System; +using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; -using Microsoft.Graph.Models; using Microsoft.Kiota.Abstractions; using Wino.Core.Domain.Entities.Shared; +using Wino.Core.Domain.Interfaces; namespace Wino.Core.Synchronizers.Calendar { - public class OutlookCalendarSynchronizer : BaseCalendarSynchronizer + public class OutlookCalendarSynchronizer : BaseSynchronizer { - public OutlookCalendarSynchronizer(MailAccount account) + public OutlookCalendarSynchronizer(MailAccount account) : base(account) { - Account = account; } - public MailAccount Account { get; } - - public override Task CreateCalendarEventAsync(RequestInformation request) + public override Task ExecuteNativeRequestsAsync(List> batchedRequests, CancellationToken cancellationToken = default) { throw new NotImplementedException(); }