Initial commit.

This commit is contained in:
Burak Kaan Köse
2024-04-18 01:44:37 +02:00
parent 524ea4c0e1
commit 12d3814626
671 changed files with 77295 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
namespace Wino.Core.Domain.Interfaces
{
/// <summary>
/// An interface that should force synchronizer to do synchronization for only given folder ids
/// after the execution is completed.
/// </summary>
public interface ICustomFolderSynchronizationRequest
{
/// <summary>
/// Which folders to sync after this operation?
/// </summary>
List<Guid> SynchronizationFolderIds { get; }
}
}

View File

@@ -0,0 +1,11 @@
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Interfaces
{
public interface IAccountCreationDialog
{
void ShowDialog();
void Complete();
AccountCreationDialogState State { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using System.Collections.Generic;
using Wino.Core.Domain.Entities;
namespace Wino.Core.Domain.Interfaces
{
public interface IAccountMenuItem : IMenuItem
{
double SynchronizationProgress { get; set; }
int UnreadItemCount { get; set; }
IEnumerable<MailAccount> HoldingAccounts { get; }
void UpdateAccount(MailAccount account);
}
}

View File

@@ -0,0 +1,6 @@
namespace Wino.Core.Domain.Interfaces
{
public interface IAccountPickerDialog
{
}
}

View File

@@ -0,0 +1,17 @@
using System;
namespace Wino.Core.Domain.Interfaces
{
public interface IAccountProviderDetailViewModel
{
/// <summary>
/// Entity id that will help to identify the startup entity on launch.
/// </summary>
Guid StartupEntityId { get; }
/// <summary>
/// Name representation of the view model that will be used to identify the startup entity on launch.
/// </summary>
string StartupEntityTitle { get; }
}
}

View File

@@ -0,0 +1,11 @@
using Wino.Core.Domain.Entities;
namespace Wino.Core.Domain.Interfaces
{
public interface IAccountProviderDetails
{
MailAccount Account { get; set; }
bool AutoExtend { get; set; }
IProviderDetail ProviderDetail { get; set; }
}
}

View File

@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Wino.Core.Domain.Entities;
namespace Wino.Core.Domain.Interfaces
{
public interface IAccountService
{
/// <summary>
/// Current IAuthenticator that should receive external authentication process to continue with.
/// For example: Google auth will launch a browser authentication. After it completes, this is the IAuthenticator
/// to continue process for token exchange.
/// </summary>
IAuthenticator ExternalAuthenticationAuthenticator { get; set; }
/// <summary>
/// Returns all local accounts.
/// </summary>
/// <returns>All local accounts</returns>
Task<List<MailAccount>> GetAccountsAsync();
/// <summary>
/// Returns single MailAccount
/// </summary>
/// <param name="accountId">AccountId.</param>
Task<MailAccount> GetAccountAsync(Guid accountId);
/// <summary>
/// Deletes all information about the account, including token information.
/// </summary>
/// <param name="account">MailAccount to be removed</param>
Task DeleteAccountAsync(MailAccount account);
/// <summary>
/// Returns the custom server information for the given account id.
/// </summary>
Task<CustomServerInformation> GetAccountCustomServerInformationAsync(Guid accountId);
/// <summary>
/// Updates the given account properties.
/// </summary>
Task UpdateAccountAsync(MailAccount account);
/// <summary>
/// Creates new account with the given server information if any.
/// Also sets the account as Startup account if there are no accounts.
/// </summary>
Task CreateAccountAsync(MailAccount account, TokenInformation tokenInformation, CustomServerInformation customServerInformation);
/// <summary>
/// Fixed authentication errors for account by forcing interactive login.
/// </summary>
Task FixTokenIssuesAsync(Guid accountId);
/// <summary>
/// Removed the attention from an account.
/// </summary>
/// <param name="accountId">Account id to remove from</param>
Task ClearAccountAttentionAsync(Guid accountId);
/// <summary>
/// Updates the account synchronization identifier.
/// For example: Gmail uses this identifier to keep track of the last synchronization.
/// Update is ignored for Gmail if the new identifier is older than the current one.
/// </summary>
/// <param name="newIdentifier">Identifier to update</param>
/// <returns>Current account synchronization modifier.</returns>
Task<string> UpdateSynchronizationIdentifierAsync(Guid accountId, string newIdentifier);
Task RenameMergedAccountAsync(Guid mergedInboxId, string newName);
Task CreateMergeAccountsAsync(MergedInbox mergedInbox, IEnumerable<MailAccount> accountsToMerge);
Task UpdateMergedInboxAsync(Guid mergedInboxId, IEnumerable<Guid> linkedAccountIds);
Task UnlinkMergedInboxAsync(Guid mergedInboxId);
}
}

View File

@@ -0,0 +1,11 @@
using System.Threading.Tasks;
namespace Wino.Core.Domain.Interfaces
{
public interface IAppInitializerService
{
string GetApplicationDataFolder();
Task MigrateAsync();
}
}

View File

@@ -0,0 +1,11 @@
namespace Wino.Core.Domain.Interfaces
{
public interface IApplicationResourceManager<T>
{
void RemoveResource(T resource);
void AddResource(T resource);
bool ContainsResourceKey(string resourceKey);
void ReplaceResource(string resourceKey, object resource);
T GetLastResource();
}
}

View File

@@ -0,0 +1,9 @@
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Interfaces
{
public interface IAuthenticationProvider
{
IAuthenticator GetAuthenticator(MailProviderType providerType);
}
}

View File

@@ -0,0 +1,53 @@
using System;
using System.Threading.Tasks;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Interfaces
{
public interface IAuthenticator
{
/// <summary>
/// Type of the provider.
/// </summary>
MailProviderType ProviderType { get; }
/// <summary>
/// Gets the token from the cache if exists.
/// If the token is expired, tries to refresh.
/// This can throw AuthenticationAttentionException if silent refresh fails.
/// </summary>
/// <param name="account">Account to get token for.</param>
/// <returns>Valid token info to be used in integrators.</returns>
Task<TokenInformation> GetTokenAsync(MailAccount account);
/// <summary>
/// Initial creation of token. Requires user interaction.
/// This will save token into database, but still returns for account creation
/// since account address is required.
/// </summary>
/// <param name="expectedAccountAddress">Token cache might ask for regeneration of token for specific
/// account address. If one is provided and re-generation native token doesn't belong to this address
/// token saving to database won't happen.</param>
/// <returns>Freshly created TokenInformation..</returns>
Task<TokenInformation> GenerateTokenAsync(MailAccount account, bool saveToken);
/// <summary>
/// Required for external authorization on launched browser to continue.
/// Used for Gmail.
/// </summary>
/// <param name="authorizationResponseUri">Response's redirect uri.</param>
void ContinueAuthorization(Uri authorizationResponseUri);
/// <summary>
/// For external browser required authentications.
/// Canceling Gmail authentication dialog etc.
/// </summary>
void CancelAuthorization();
/// <summary>
/// ClientId in case of needed for authorization/authentication.
/// </summary>
string ClientId { get; }
}
}

View File

@@ -0,0 +1,18 @@
using System.Threading.Tasks;
using Wino.Core.Domain.Models.AutoDiscovery;
namespace Wino.Core.Domain.Interfaces
{
/// <summary>
/// Searches for Auto Discovery settings for custom mail accounts.
/// </summary>
public interface IAutoDiscoveryService
{
/// <summary>
/// Tries to return the best mail server settings using different techniques.
/// </summary>
/// <param name="mailAddress">Address to search settings for.</param>
/// <returns>CustomServerInformation with only settings applied.</returns>
Task<AutoDiscoverySettings> GetAutoDiscoverySettings(AutoDiscoveryMinimalSettings autoDiscoveryMinimalSettings);
}
}

View File

@@ -0,0 +1,19 @@
using System.Threading.Tasks;
namespace Wino.Core.Domain.Interfaces
{
public interface IBackgroundTaskService
{
/// <summary>
/// Manages background task registrations, requests access if needed, checks the statusses of them etc.
/// </summary>
/// <exception cref="BackgroundTaskExecutionRequestDeniedException">If the access request is denied for some reason.</exception>
/// <exception cref="BackgroundTaskRegistrationFailedException">If one of the requires background tasks are failed during registration.</exception>
Task HandleBackgroundTaskRegistrations();
/// <summary>
/// Unregisters all existing background tasks. Useful for migrations.
/// </summary>
void UnregisterAllBackgroundTask();
}
}

View File

@@ -0,0 +1,9 @@
using System.Threading.Tasks;
namespace Wino.Core.Domain.Interfaces
{
public interface IClipboardService
{
Task CopyClipboardAsync(string text);
}
}

View File

@@ -0,0 +1,11 @@
namespace Wino.Core.Domain.Interfaces
{
public interface IConfigurationService
{
void Set(string key, object value);
T Get<T>(string key, T defaultValue = default);
void SetRoaming(string key, object value);
T GetRoaming<T>(string key, T defaultValue = default);
}
}

View File

@@ -0,0 +1,9 @@
using System.Threading.Tasks;
namespace Wino.Core.Domain.Interfaces
{
public interface IConfirmationDialog
{
Task<bool> ShowDialogAsync(string title, string message, string approveButtonTitle);
}
}

View File

@@ -0,0 +1,14 @@
using System.Collections.Generic;
using Wino.Core.Domain.Models.Folders;
using Wino.Core.Domain.Models.MailItem;
using Wino.Core.Domain.Models.Menus;
namespace Wino.Core.Domain.Interfaces
{
public interface IContextMenuItemService
{
IEnumerable<FolderOperationMenuItem> GetFolderContextMenuActions(IBaseFolderMenuItem folderInformation);
IEnumerable<MailOperationMenuItem> GetMailItemContextMenuActions(IEnumerable<IMailItem> selectedMailItems);
IEnumerable<MailOperationMenuItem> GetMailItemRenderMenuActions(IMailItem mailItem, bool isDarkEditor);
}
}

View File

@@ -0,0 +1,30 @@
using System.Collections.Generic;
using Wino.Core.Domain.Models.Folders;
using Wino.Core.Domain.Models.MailItem;
using Wino.Core.Domain.Models.Menus;
namespace Wino.Core.Domain.Interfaces
{
public interface IContextMenuProvider
{
/// <summary>
/// Calculates and returns available folder operations for the given folder.
/// </summary>
/// <param name="folderInformation">Folder to get actions for.</param>
IEnumerable<FolderOperationMenuItem> GetFolderContextMenuActions(IMailItemFolder folderInformation);
/// <summary>
/// Calculates and returns available context menu items for selected mail items.
/// </summary>
/// <param name="folderInformation">Current folder that asks for the menu items.</param>
/// <param name="selectedMailItems">Selected menu items in the given folder.</param>
IEnumerable<MailOperationMenuItem> GetMailItemContextMenuActions(IMailItemFolder folderInformation, IEnumerable<IMailItem> selectedMailItems);
/// <summary>
/// Calculates and returns available mail operations for mail rendering CommandBar.
/// </summary>
/// <param name="mailItem">Rendered mail item.</param>
/// <param name="activeFolder">Folder that mail item belongs to.</param>
IEnumerable<MailOperationMenuItem> GetMailItemRenderMenuActions(IMailItem mailItem, IMailItemFolder activeFolder, bool isDarkEditor);
}
}

View File

@@ -0,0 +1,19 @@
using System.Threading.Tasks;
using Wino.Core.Domain.Entities;
namespace Wino.Core.Domain.Interfaces
{
public interface ICustomServerAccountCreationDialog : IAccountCreationDialog
{
/// <summary>
/// Returns the custom server information from the dialog..
/// </summary>
/// <returns>Null if canceled.</returns>
Task<CustomServerInformation> GetCustomServerInformationAsync();
/// <summary>
/// Displays preparing folders page.
/// </summary>
void ShowPreparingFolders();
}
}

View File

@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Folders;
namespace Wino.Core.Domain.Interfaces
{
public interface IDialogService
{
Task<string> PickWindowsFolderAsync();
Task<byte[]> PickWindowsFileContentAsync(params object[] typeFilters);
Task<bool> ShowConfirmationDialogAsync(string question, string title, string confirmationButtonTitle);
Task<bool> ShowHardDeleteConfirmationAsync();
Task<IStoreRatingDialog> ShowRatingDialogAsync();
Task HandleSystemFolderConfigurationDialogAsync(Guid accountId, IFolderService folderService);
Task<bool> ShowCustomThemeBuilderDialogAsync();
Task ShowMessageAsync(string message, string title);
void InfoBarMessage(string title, string message, InfoBarMessageType messageType);
void InfoBarMessage(string title, string message, InfoBarMessageType messageType, string actionButtonText, Action action);
void ShowNotSupportedMessage();
// Custom dialogs
Task<IMailItemFolder> ShowMoveMailFolderDialogAsync(List<IMailItemFolder> availableFolders);
Task<Tuple<string, MailProviderType>> ShowNewAccountMailProviderDialogAsync(List<IProviderDetail> availableProviders);
IAccountCreationDialog GetAccountCreationDialog(MailProviderType type);
Task<string> ShowTextInputDialogAsync(string currentInput, string dialogTitle, string dialogDescription);
Task<MailAccount> ShowEditAccountDialogAsync(MailAccount account);
Task<MailAccount> ShowAccountPickerDialogAsync(List<MailAccount> availableAccounts);
/// <summary>
/// Presents a dialog to the user for selecting folder.
/// </summary>
/// <param name="accountId">Account to get folders for.</param>
/// <param name="reason">The reason behind the picking operation
/// <returns>Selected folder structure. Null if none.</returns>
Task<IMailItemFolder> PickFolderAsync(Guid accountId, PickFolderReason reason, IFolderService folderService);
}
}

View File

@@ -0,0 +1,10 @@
using System;
using System.Threading.Tasks;
namespace Wino.Core.Domain.Interfaces
{
public interface IDispatcher
{
Task ExecuteOnUIThread(Action action);
}
}

View File

@@ -0,0 +1,12 @@
using System.IO;
using System.Threading.Tasks;
namespace Wino.Core.Domain.Interfaces
{
public interface IFileService
{
Task<string> CopyFileAsync(string sourceFilePath, string destinationFolderPath);
Task<Stream> GetFileStreamAsync(string folderPath, string fileName);
Task<string> GetFileContentByApplicationUriAsync(string resourcePath);
}
}

View File

@@ -0,0 +1,30 @@
using System.Collections.Generic;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Folders;
namespace Wino.Core.Domain.Interfaces
{
public interface IFolderMenuItem : IBaseFolderMenuItem
{
MailAccount ParentAccount { get; }
}
public interface IMergedAccountFolderMenuItem : IBaseFolderMenuItem { }
public interface IBaseFolderMenuItem : IMenuItem
{
string FolderName { get; }
bool IsSynchronizationEnabled { get; }
int UnreadItemCount { get; set; }
SpecialFolderType SpecialFolderType { get; }
IEnumerable<IMailItemFolder> HandlingFolders { get; }
bool IsMoveTarget { get; }
bool IsSticky { get; }
bool IsSystemFolder { get; }
bool ShowUnreadCount { get; }
string AssignedAccountName { get; }
void UpdateFolder(IMailItemFolder folder);
}
}

View File

@@ -0,0 +1,92 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Folders;
using Wino.Core.Domain.Models.MailItem;
using Wino.Core.Domain.Models.Synchronization;
namespace Wino.Core.Domain.Interfaces
{
public interface IFolderService
{
Task<AccountFolderTree> GetFolderStructureForAccountAsync(Guid accountId, bool includeHiddenFolders);
Task<MailItemFolder> GetFolderAsync(Guid folderId);
Task<MailItemFolder> GetFolderAsync(Guid accountId, string remoteFolderId);
Task<List<MailItemFolder>> GetFoldersAsync(Guid accountId);
Task<List<MailItemFolder>> GetUnreadUpdateFoldersAsync(Guid accountId);
Task SetSpecialFolderAsync(Guid folderId, SpecialFolderType type);
Task<MailItemFolder> GetSpecialFolderByAccountIdAsync(Guid accountId, SpecialFolderType type);
Task<int> GetCurrentItemCountForFolder(Guid folderId);
Task<int> GetFolderNotificationBadgeAsync(Guid folderId);
Task ChangeStickyStatusAsync(Guid folderId, bool isSticky);
Task UpdateCustomServerMailListAsync(Guid accountId, List<MailItemFolder> folders);
Task<MailAccount> UpdateSystemFolderConfigurationAsync(Guid accountId, SystemFolderConfiguration configuration);
Task ChangeFolderSynchronizationStateAsync(Guid folderId, bool isSynchronizationEnabled);
Task ChangeFolderShowUnreadCountStateAsync(Guid folderId, bool showUnreadCount);
Task<List<MailItemFolder>> GetSynchronizationFoldersAsync(SynchronizationOptions options);
/// <summary>
/// Returns the folder - mail mapping for the given mail copy ids.
/// </summary>
Task<List<MailFolderPairMetadata>> GetMailFolderPairMetadatasAsync(IEnumerable<string> mailCopyIds);
/// <summary>
/// Returns the folder - mail mapping for the given mail copy id.
/// </summary>
Task<List<MailFolderPairMetadata>> GetMailFolderPairMetadatasAsync(string mailCopyId);
// v2
/// <summary>
/// Performs bulk update for the given folders.
/// Used in Gmail.
/// </summary>
/// <param name="accountId">Account that folders belong to.</param>
/// <param name="allFolders">Folders to update.</param>
Task BulkUpdateFolderStructureAsync(Guid accountId, List<MailItemFolder> allFolders);
/// <summary>
/// Updates Folder's delta synchronization identifier.
/// Only used in Outlook since it does per-folder sync.
/// </summary>
/// <param name="folderId">Folder id</param>
/// <param name="synchronizationIdentifier">New synchronization identifier.</param>
/// <returns>New identifier if success.</returns>
Task<string> UpdateFolderDeltaSynchronizationIdentifierAsync(Guid folderId, string synchronizationIdentifier);
/// <summary>
/// Deletes the folder for the given account by remote folder id.
/// </summary>
/// <param name="accountId">Account to remove from.</param>
/// <param name="remoteFolderId">Remote folder id.</param>
/// <returns></returns>
Task DeleteFolderAsync(Guid accountId, string remoteFolderId);
/// <summary>
/// Adds a new folder.
/// </summary>
/// <param name="folder">Folder to add.</param>
Task InsertFolderAsync(MailItemFolder folder);
/// <summary>
/// Returns the known uids for the given folder.
/// Only used for IMAP
/// </summary>
/// <param name="folderId">Folder to get uIds for</param>
Task<IList<uint>> GetKnownUidsForFolderAsync(Guid folderId);
/// <summary>
/// Checks if Inbox special folder exists for an account.
/// </summary>
/// <param name="accountId">Account id to check for.</param>
/// <returns>True if Inbox exists, False if not.</returns>
Task<bool> IsInboxAvailableForAccountAsync(Guid accountId);
Task TestAsync();
}
}

View File

@@ -0,0 +1,16 @@
using System.Collections.Generic;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Reader;
namespace Wino.Core.Domain.Interfaces
{
public interface IFontService
{
List<ReaderFontModel> GetReaderFonts();
ReaderFontModel GetCurrentReaderFont();
int GetCurrentReaderFontSize();
void ChangeReaderFont(ReaderFont font);
void ChangeReaderFontSize(int size);
}
}

View File

@@ -0,0 +1,10 @@
using System.Threading.Tasks;
using Wino.Core.Domain.Entities;
namespace Wino.Core.Domain.Interfaces
{
public interface IImapTestService
{
Task TestImapConnectionAsync(CustomServerInformation serverInformation);
}
}

View File

@@ -0,0 +1,12 @@
using System.Threading.Tasks;
namespace Wino.Core.Domain.Interfaces
{
/// <summary>
/// An interface that all startup services must implement.
/// </summary>
public interface IInitializeAsync
{
Task InitializeAsync();
}
}

View File

@@ -0,0 +1,8 @@
namespace Wino.Core.Domain.Interfaces
{
public interface IKeyPressService
{
bool IsCtrlKeyPressed();
bool IsShiftKeyPressed();
}
}

View File

@@ -0,0 +1,10 @@
using System.Collections.Specialized;
namespace Wino.Core.Domain.Interfaces
{
public interface ILaunchProtocolService
{
object LaunchParameter { get; set; }
NameValueCollection MailtoParameters { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace Wino.Core.Domain.Interfaces
{
public interface ILogInitializer
{
void SetupLogger(string logFolderPath);
void RefreshLoggingLevel();
}
}

View File

@@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using MimeKit;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Models.MailItem;
namespace Wino.Core.Domain.Interfaces
{
public interface IMailService
{
Task<MailCopy> GetSingleMailItemAsync(string mailCopyId, string remoteFolderId);
Task<MailCopy> GetSingleMailItemAsync(Guid uniqueMailId);
Task<MailCopy> CreateDraftAsync(MailAccount composerAccount, MimeMessage generatedReplyMime, MimeMessage replyingMimeMessage = null, IMailItem replyingMailItem = null);
Task<List<IMailItem>> FetchMailsAsync(MailListInitializationOptions options);
Task<List<string>> GetMailIdsByFolderIdAsync(Guid folderId);
// v2
/// <summary>
/// Deletes all mail copies for all folders.
/// </summary>
/// <param name="accountId">Account to remove from</param>
/// <param name="mailCopyId">Mail copy id to remove.</param>
Task DeleteMailAsync(Guid accountId, string mailCopyId);
Task ChangeReadStatusAsync(string mailCopyId, bool isRead);
Task ChangeFlagStatusAsync(string mailCopyId, bool isFlagged);
Task CreateAssignmentAsync(Guid accountId, string mailCopyId, string remoteFolderId);
Task DeleteAssignmentAsync(Guid accountId, string mailCopyId, string remoteFolderId);
Task<bool> CreateMailAsync(Guid accountId, NewMailItemPackage package);
/// <summary>
/// Maps new mail item with the existing local draft copy.
/// In case of failure, it returns false.
/// Then synchronizers must insert a new mail item.
/// </summary>
/// <param name="accountId">Id of the account. It's important to map to the account since if the user use the same account with different providers, this call must map the correct one.</param>
/// <param name="localDraftCopyUniqueId">UniqueId of the local draft copy.</param>
/// <param name="newMailCopyId">New assigned remote mail item id.</param>
/// <param name="newDraftId">New assigned draft id if exists.</param>
/// <param name="newThreadId">New message's thread/conversation id.</param>
/// <returns>True if mapping is done. False if local copy doesn't exists.</returns>
Task<bool> MapLocalDraftAsync(Guid accountId, Guid localDraftCopyUniqueId, string newMailCopyId, string newDraftId, string newThreadId);
/// <summary>
/// Maps new mail item with the existing local draft copy.
///
/// </summary>
/// <param name="newMailCopyId"></param>
/// <param name="newDraftId"></param>
/// <param name="newThreadId"></param>
/// <returns></returns>
Task MapLocalDraftAsync(string newMailCopyId, string newDraftId, string newThreadId);
Task<MimeMessage> CreateDraftMimeMessageAsync(Guid accountId, DraftCreationOptions options);
Task UpdateMailAsync(MailCopy mailCopy);
/// <summary>
/// Gets the new inserted unread mails after the synchronization.
/// </summary>
/// <param name="accountId">Account id.</param>
/// <param name="downloadedMailCopyIds">
/// Mail ids that synchronizer tried to download. If there was an issue with the
/// Items that tried and actually downloaded may differ. This function will return only new inserted ones.
/// </param>
/// <returns>Newly inserted unread mails inside the Inbox folder.</returns>
Task<List<MailCopy>> GetDownloadedUnreadMailsAsync(Guid accountId, IEnumerable<string> downloadedMailCopyIds);
/// <summary>
/// Returns the account that this mail copy unique id is assigned.
/// Used in toast notification handler.
/// </summary>
/// <param name="uniqueMailId">Unique id of the mail item.</param>
/// <returns>Account that mail belongs to.</returns>
Task<MailAccount> GetMailAccountByUniqueIdAsync(Guid uniqueMailId);
}
}

View File

@@ -0,0 +1,41 @@
using System;
namespace Wino.Core.Domain.Interfaces
{
public interface IMenuItem
{
/// <summary>
/// An id that this menu item holds.
/// For an account, it's AccountId.
/// For folder, it's FolderId.
/// For merged account, it's MergedAccountId.
/// Null if it's a menu item that doesn't hold any valuable entity.
/// </summary>
Guid? EntityId { get; }
/// <summary>
/// Is any of the sub items that this menu item contains selected.
/// </summary>
// bool IsChildSelected { get; }
/// <summary>
/// Whether the menu item is expanded or not.
/// </summary>
bool IsExpanded { get; set; }
/// <summary>
/// Whether the menu item is selected or not.
/// </summary>
bool IsSelected { get; set; }
/// <summary>
/// Parent menu item that contains this menu item.
/// </summary>
IMenuItem ParentMenuItem { get; }
/// <summary>
/// Recursively expand all parent menu items if parent exists, starting from parent.
/// </summary>
void Expand();
}
}

View File

@@ -0,0 +1,8 @@
namespace Wino.Core.Domain.Interfaces
{
public interface IMenuOperation
{
bool IsEnabled { get; }
string Identifier { get; }
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Threading.Tasks;
using Wino.Core.Domain.Models.Authorization;
namespace Wino.Core.Domain.Interfaces
{
public interface INativeAppService
{
string GetWebAuthenticationBrokerUri();
Task<string> GetMimeMessageStoragePath();
Task<string> GetQuillEditorBundlePathAsync();
Task LaunchFileAsync(string filePath);
Task LaunchUriAsync(Uri uri);
bool IsAppRunning();
string GetFullAppVersion();
Task PinAppToTaskbarAsync();
/// <summary>
/// Some cryptographic shit is needed for requesting Google authentication in UWP.
/// </summary>
GoogleAuthorizationRequest GetGoogleAuthorizationRequest();
}
}

View File

@@ -0,0 +1,10 @@
using Wino.Core.Domain.Models.Navigation;
namespace Wino.Core.Domain.Interfaces
{
public interface INavigationAware
{
void OnNavigatedTo(NavigationMode mode, object parameters);
void OnNavigatedFrom(NavigationMode mode, object parameters);
}
}

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Wino.Core.Domain.Models.MailItem;
namespace Wino.Core.Domain.Interfaces
{
public interface INotificationBuilder
{
/// <summary>
/// Creates toast notifications for new mails.
/// </summary>
Task CreateNotificationsAsync(Guid inboxFolderId, IEnumerable<IMailItem> newMailItems);
/// <summary>
/// Gets the unread Inbox messages for each account and updates the taskbar icon.
/// </summary>
/// <returns></returns>
Task UpdateTaskbarIconBadgeAsync();
/// <summary>
/// Creates test notification for test purposes.
/// </summary>
Task CreateTestNotificationAsync(string title, string message);
}
}

View File

@@ -0,0 +1,144 @@
using System;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Reader;
namespace Wino.Core.Domain.Interfaces
{
public interface IPreferencesService
{
/// <summary>
/// When any of the preferences are changed.
/// </summary>
event EventHandler<string> PreferenceChanged;
/// <summary>
/// Setting: For changing the mail display container mode.
/// </summary>
MailListDisplayMode MailItemDisplayMode { get; set; }
/// <summary>
/// Setting: Marking the item as read preference mode.
/// </summary>
MailMarkAsOption MarkAsPreference { get; set; }
/// <summary>
/// Setting: Preferred time format for mail display.
/// </summary>
bool Prefer24HourTimeFormat { get; set; }
/// <summary>
/// Setting: How many seconds should be waited on rendering page to mark item as read.
/// </summary>
int MarkAsDelay { get; set; }
/// <summary>
/// Setting: Ask comfirmation from the user during permanent delete.
/// </summary>
bool IsHardDeleteProtectionEnabled { get; set; }
/// <summary>
/// Setting: Thread mails into conversations.
/// </summary>
bool IsThreadingEnabled { get; set; }
/// <summary>
/// Setting: Show sender pictures in mail list.
/// </summary>
bool IsShowSenderPicturesEnabled { get; set; }
/// <summary>
/// Setting: Show preview text in mail list.
/// </summary>
bool IsShowPreviewEnabled { get; set; }
/// <summary>
/// Setting: Enable/disable semantic zoom on clicking date headers.
/// </summary>
bool IsSemanticZoomEnabled { get; set; }
/// <summary>
/// Setting: Set whether 'img' tags in rendered HTMLs should be removed.
/// </summary>
bool RenderImages { get; set; }
/// <summary>
/// Setting: Set whether 'style' tags in rendered HTMls should be removed.
/// </summary>
bool RenderStyles { get; set; }
/// <summary>
/// Gets the preferred rendering options for HTML rendering.
/// </summary>
MailRenderingOptions GetRenderingOptions();
/// <summary>
/// Setting: Swipe mail operation when mails are swiped to right.
/// </summary>
MailOperation RightSwipeOperation { get; set; }
/// <summary>
/// Setting: Swipe mail operation when mails are swiped to left.
/// </summary>
MailOperation LeftSwipeOperation { get; set; }
/// <summary>
/// Setting: Whether hover actions on mail pointer hover is enabled or not.
/// </summary>
bool IsHoverActionsEnabled { get; set; }
/// <summary>
/// Setting: Hover action on the left when the mail is hovered over.
/// </summary>
MailOperation LeftHoverAction { get; set; }
/// <summary>
/// Setting: Hover action on the center when the mail is hovered over.
/// </summary>
MailOperation CenterHoverAction { get; set; }
/// <summary>
/// Setting: Hover action on the right when the mail is hovered over.
/// </summary>
MailOperation RightHoverAction { get; set; }
/// <summary>
/// Setting: Whether logs are enabled or not.
/// </summary>
bool IsLoggingEnabled { get; set; }
/// <summary>
/// Setting: Whether Mailkit Protocol Logger is enabled for ImapTestService or not.
/// </summary>
bool IsMailkitProtocolLoggerEnabled { get; set; }
/// <summary>
/// Setting: Which entity id (merged account or folder) should be expanded automatically on startup.
/// </summary>
Guid? StartupEntityId { get; set; }
/// <summary>
/// Setting: Display language for the application.
/// </summary>
AppLanguage CurrentLanguage { get; set; }
/// <summary>
/// Setting: Display font for the mail reader. Not composer.
/// </summary>
ReaderFont ReaderFont { get; set; }
/// <summary>
/// Setting: Font size for the mail reader. Not composer.
/// </summary>
int ReaderFontSize { get; set; }
/// <summary>
/// Setting: Whether the navigation pane is opened on the last session or not.
/// </summary>
bool IsNavigationPaneOpened { get; set; }
/// <summary>
/// Setting: Whether the next item should be automatically selected once the current item is moved or removed.
/// </summary>
bool AutoSelectNextItem { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Interfaces
{
public interface IProviderDetail
{
MailProviderType Type { get; }
string Name { get; }
string Description { get; }
string ProviderImage { get; }
bool IsSupported { get; }
}
}

View File

@@ -0,0 +1,11 @@
using System.Collections.Generic;
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Interfaces
{
public interface IProviderService
{
List<IProviderDetail> GetProviderDetails();
IProviderDetail GetProviderDetail(MailProviderType type);
}
}

View File

@@ -0,0 +1,60 @@
using System.Collections.Generic;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Interfaces
{
/// <summary>
/// Represents a group of requests.
/// </summary>
public interface IRequestBundle
{
string BundleId { get; set; }
IRequestBase Request { get; }
}
/// <summary>
/// Represents a group of requests with their native response types.
/// </summary>
/// <typeparam name="TRequest">Native request type from each synchronizer to store.</typeparam>
public interface IRequestBundle<TRequest> : IRequestBundle
{
TRequest NativeRequest { get; }
}
public interface IRequestBase
{
/// <summary>
/// Synchronizer option to perform.
/// </summary>
MailSynchronizerOperation Operation { get; }
/// <summary>
/// UI changes to apply to the item before sending the request to the server.
/// Changes here only affect the UI, not the item itself.
/// Changes here are reverted if the request fails by calling <see cref="RevertUIChanges"/>.
/// </summary>
void ApplyUIChanges();
/// <summary>
/// Reverts the UI changes applied by <see cref="ApplyUIChanges"/> if the request fails.
/// </summary>
void RevertUIChanges();
}
public interface IRequest : IRequestBase
{
MailCopy Item { get; }
IBatchChangeRequest CreateBatch(IEnumerable<IRequest> requests);
}
public interface IFolderRequest : IRequestBase
{
MailItemFolder Folder { get; }
}
public interface IBatchChangeRequest : IRequestBase
{
IEnumerable<IRequest> Items { get; }
}
}

View File

@@ -0,0 +1,33 @@
using System;
using System.Threading.Tasks;
using Wino.Core.Domain.Entities;
namespace Wino.Core.Domain.Interfaces
{
public interface ISignatureService
{
/// <summary>
/// Returns the assigned account signature for the account.
/// </summary>
/// <param name="accountId"></param>
/// <returns></returns>
Task<AccountSignature> GetAccountSignatureAsync(Guid accountId);
/// <summary>
/// Creates the initial signature for new created accounts.
/// </summary>
/// <param name="accountId"></param>
/// <returns></returns>
Task<AccountSignature> CreateDefaultSignatureAsync(Guid accountId);
/// <summary>
/// Updates account's existing signature with the given HTML signature.
/// </summary>
Task<AccountSignature> UpdateAccountSignatureAsync(Guid accountId, string htmlBody);
/// <summary>
/// Disabled signature for the account and deletes existing signature.
/// </summary>
Task DeleteAccountSignatureAssignment(Guid accountId);
}
}

View File

@@ -0,0 +1,47 @@
using System;
using System.ComponentModel;
namespace Wino.Core.Domain.Interfaces
{
public interface IStatePersistanceService : INotifyPropertyChanged
{
event EventHandler<string> StatePropertyChanged;
/// <summary>
/// True when there is an active renderer for selected mail.
/// </summary>
bool IsReadingMail { get; set; }
/// <summary>
/// Shell's app bar title string.
/// </summary>
string CoreWindowTitle { get; set; }
/// <summary>
/// When only reader page is visible in small sized window.
/// </summary>
bool IsReaderNarrowed { get; set; }
/// <summary>
/// Should display back button on the shell title bar.
/// </summary>
bool IsBackButtonVisible { get; }
/// <summary>
/// Setting: Opened pane length for the navigation view.
/// </summary>
double OpenPaneLength { get; set; }
/// <summary>
/// Whether the mail rendering page should be shifted from top to adjust the design
/// for standalone EML viewer or not.
/// </summary>
bool ShouldShiftMailRenderingDesign { get; set; }
/// <summary>
/// Setting: Mail list pane length for listing mails.
/// </summary>
double MailListPaneLength { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
using System.Threading.Tasks;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Store;
namespace Wino.Core.Domain.Interfaces
{
public interface IStoreManagementService
{
/// <summary>
/// Checks whether user has the type of an add-on purchased.
/// </summary>
Task<bool> HasProductAsync(StoreProductType productType);
/// <summary>
/// Attempts to purchase the given add-on.
/// </summary>
Task<StorePurchaseResult> PurchaseAsync(StoreProductType productType);
}
}

View File

@@ -0,0 +1,8 @@
namespace Wino.Core.Domain.Interfaces
{
public interface IStoreRatingDialog
{
bool DontAskAgain { get; }
bool RateWinoClicked { get; }
}
}

View File

@@ -0,0 +1,10 @@
using System.Threading.Tasks;
namespace Wino.Core.Domain.Interfaces
{
public interface IStoreRatingService
{
Task PromptRatingDialogAsync();
Task LaunchStorePageForReviewAsync();
}
}

View File

@@ -0,0 +1,19 @@
using System;
namespace Wino.Core.Domain.Interfaces
{
/// <summary>
/// An interface for reporting progress of the synchronization.
/// Gmail does not support reporting folder progress.
/// For others, account progress is calculated based on the number of folders.
/// </summary>
public interface ISynchronizationProgress
{
/// <summary>
/// Reports account synchronization progress.
/// </summary>
/// <param name="accountId">Account id for the report.</param>
/// <param name="progress">Value. This is always between 0 - 100</param>
void AccountProgressUpdated(Guid accountId, int progress);
}
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Personalization;
namespace Wino.Core.Domain.Interfaces
{
public interface IThemeService : IInitializeAsync
{
event EventHandler<ApplicationElementTheme> ElementThemeChanged;
event EventHandler<string> AccentColorChangedBySystem;
event EventHandler<string> AccentColorChanged;
Task<List<AppThemeBase>> GetAvailableThemesAsync();
Task<CustomThemeMetadata> CreateNewCustomThemeAsync(string themeName, string accentColor, byte[] wallpaperData);
Task<List<CustomThemeMetadata>> GetCurrentCustomThemesAsync();
Task ApplyCustomThemeAsync(bool isInitializing);
// Settings
ApplicationElementTheme RootTheme { get; set; }
Guid CurrentApplicationThemeId { get; set; }
string AccentColor { get; set; }
string GetSystemAccentColorHex();
}
}

View File

@@ -0,0 +1,13 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Models.MailItem;
namespace Wino.Core.Domain.Interfaces
{
public interface IThreadingStrategy
{
Task<List<IMailItem>> ThreadItemsAsync(List<MailCopy> items);
bool ShouldThreadWithItem(IMailItem originalItem, IMailItem targetItem);
}
}

View File

@@ -0,0 +1,13 @@
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Interfaces
{
public interface IThreadingStrategyProvider
{
/// <summary>
/// Returns corresponding threading strategy that applies to given provider type.
/// </summary>
/// <param name="mailProviderType">Provider type.</param>
IThreadingStrategy GetStrategy(MailProviderType mailProviderType);
}
}

View File

@@ -0,0 +1,13 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Translations;
namespace Wino.Core.Domain.Interfaces
{
public interface ITranslationService : IInitializeAsync
{
Task InitializeLanguageAsync(AppLanguage language, bool ignoreCurrentLanguageCheck = false);
List<AppLanguageModel> GetAvailableLanguages();
}
}

View File

@@ -0,0 +1,7 @@
namespace Wino.Core.Domain.Interfaces
{
public interface IUnderlyingThemeService
{
bool IsUnderlyingThemeDark();
}
}

View File

@@ -0,0 +1,18 @@
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.MailItem;
using Wino.Core.Domain.Models.Navigation;
namespace Wino.Core.Domain.Interfaces
{
public interface IWinoNavigationService
{
bool Navigate(WinoPage page,
object parameter = null,
NavigationReferenceFrame frame = NavigationReferenceFrame.ShellFrame,
NavigationTransitionType transition = NavigationTransitionType.None);
void NavigateCompose(IMailItem mailItem, NavigationTransitionType transition = NavigationTransitionType.None);
void NavigateRendering(IMailItem mailItem, NavigationTransitionType transition = NavigationTransitionType.None);
void NavigateRendering(MimeMessageInformation mimeMessageInformation, NavigationTransitionType transition = NavigationTransitionType.None);
void NavigateFolder(NavigateMailFolderEventArgs args);
}
}

View File

@@ -0,0 +1,35 @@
using System.Threading.Tasks;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Folders;
using Wino.Core.Domain.Models.MailItem;
namespace Wino.Core.Domain.Interfaces
{
public interface IWinoRequestDelegator
{
/// <summary>
/// Prepares requires IRequest collection for mail actions and executes them via proper synchronizers.
/// </summary>
/// <param name="prerperationRequest">Preperation model that encapsulates action and mail items.</param>
Task ExecuteAsync(MailOperationPreperationRequest prerperationRequest);
/// <summary>
/// Queues new draft creation request for synchronizer.
/// </summary>
/// <param name="draftPreperationRequest">A class that holds the parameters for creating a draft.</param>
Task ExecuteAsync(DraftPreperationRequest draftPreperationRequest);
/// <summary>
/// Queues a new request for synchronizer to send a draft.
/// </summary>
/// <param name="draftPreperationRequest">Draft sending request.</param>
Task ExecuteAsync(SendDraftPreparationRequest sendDraftPreperationRequest);
/// <summary>
/// Prepares requires IRequest collection for folder actions and executes them via proper synchronizers.
/// </summary>
/// <param name="operation">Folder operation to execute.</param>
/// <param name="folderStructure">Target folder</param>
Task ExecuteAsync(FolderOperation operation, IMailItemFolder folderStructure);
}
}

View File

@@ -0,0 +1,22 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Folders;
using Wino.Core.Domain.Models.MailItem;
using Wino.Core.Domain.Models.Requests;
namespace Wino.Core.Domain.Interfaces
{
public interface IWinoRequestProcessor
{
Task<IRequest> PrepareFolderRequestAsync(FolderOperation operation, IMailItemFolder mailItemFolder);
/// <summary>
/// Prepares proper Wino requests for synchronizers to execute categorized by AccountId and FolderId.
/// </summary>
/// <param name="operation">User action</param>
/// <param name="mailCopyIds">Selected mails.</param>
/// <exception cref="UnavailableSpecialFolderException">When required folder target is not available for account.</exception>
Task<List<IRequest>> PrepareRequestsAsync(MailOperationPreperationRequest request);
}
}