1 Commits

Author SHA1 Message Date
Burak Kaan Köse
a641a51188 Release beta 1.7.1 2024-04-20 03:07:40 +02:00
559 changed files with 32582 additions and 26875 deletions

View File

@@ -25,7 +25,6 @@ I'm a big fan of Windows Mail & Calendars due to its simplicity. Personally, I f
- API integration for Outlook and Gmail
- IMAP/SMTP support for custom mail servers
- Send, receive, mark as (read,important,spam etc), move mails.
- Linked/Merged Accounts
- Toast notifications with background sync.
- Instant startup performance
- Offline use / search.
@@ -44,7 +43,7 @@ Download latest version of Wino Mail from Microsoft Store for free.
## Beta Releases
Stable releases will always be distributed on Microsoft Store. However, beta releases will be distributed in [GitHub Releases](https://github.com/bkaankose/Wino-Mail/releases). Please keep in mind that beta releases might not be for daily use, only for testing purposes and recommended for experienced users or developers. Beta releases are also managed manually. Therefore, code in the repository might be ahead of the released Beta version at the moment. Make sure to compare versions before tryout out the Beta version.
Stable releases will always be distributed on Microsoft Store. However, beta releases will be distributed in [GitHub Releases](https://github.com/bkaankose/Wino-Mail/releases). Please keep in mind that beta releases might not be for daily use, only for testing purposes and recommended for experienced users or developers.
These releases are distributed as side-loaded packages. To install them, download the **.msixbundle** file in GitHub releases and [follow the steps explained here.](https://learn.microsoft.com/en-us/windows/application-management/sideload-apps-in-windows)
@@ -53,6 +52,10 @@ These releases are distributed as side-loaded packages. To install them, downloa
Check out the [contribution guidelines](/CONTRIBUTING.md) before diving into the source code or opening an issue. There are multiple ways to contribute and all of them are explained in detail there.
#### Attention
Sources here **does not belong to the Store version of Wino Mail. It belongs to beta release as of April 17 2024.** I've been working on a big patch for couple months already and the code here includes those changes, but these changes are not yet released to Microsoft Store. Therefore, if you'd like to contribute, please validate the bug before in beta version and start working on it. I will delete this text from here once this big patch goes alive in the Store, so everything will be aligned then.
## Donate
Your donations will motivate me more to work on Wino in my spare time and cover the expenses to keep [project's website](https://www.winomail.app/) alive.

View File

@@ -1,42 +0,0 @@
{
"AttributesTolerance": 2,
"KeepFirstAttributeOnSameLine": false,
"MaxAttributeCharactersPerLine": 0,
"MaxAttributesPerLine": 1,
"NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransform, SkewTransform, RotateTransform, TranslateTransform, Trigger, Condition, Setter",
"SeparateByGroups": false,
"AttributeIndentation": 0,
"AttributeIndentationStyle": 1,
"RemoveDesignTimeReferences": false,
"IgnoreDesignTimeReferencePrefix": false,
"EnableAttributeReordering": true,
"AttributeOrderingRuleGroups": [
"x:Class",
"xmlns, xmlns:x",
"xmlns:*",
"x:Key, Key, x:Name, Name, x:Uid, Uid, Title",
"Grid.Row, Grid.RowSpan, Grid.Column, Grid.ColumnSpan, Canvas.Left, Canvas.Top, Canvas.Right, Canvas.Bottom",
"Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight",
"Margin, Padding, HorizontalAlignment, VerticalAlignment, HorizontalContentAlignment, VerticalContentAlignment, Panel.ZIndex",
"*:*, *",
"PageSource, PageIndex, Offset, Color, TargetName, Property, Value, StartPoint, EndPoint",
"mc:Ignorable, d:IsDataSource, d:LayoutOverrides, d:IsStaticText",
"Storyboard.*, From, To, Duration"
],
"FirstLineAttributes": "",
"OrderAttributesByName": true,
"PutEndingBracketOnNewLine": false,
"RemoveEndingTagOfEmptyElement": true,
"SpaceBeforeClosingSlash": true,
"RootElementLineBreakRule": 0,
"ReorderVSM": 2,
"ReorderGridChildren": false,
"ReorderCanvasChildren": false,
"ReorderSetters": 0,
"FormatMarkupExtension": true,
"NoNewLineMarkupExtensions": "x:Bind, Binding",
"ThicknessSeparator": 2,
"ThicknessAttributes": "Margin, Padding, BorderThickness, ThumbnailClipMargin",
"FormatOnSave": true,
"CommentPadding": 2,
}

View File

@@ -1,6 +1,7 @@
using Microsoft.Toolkit.Uwp.Notifications;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Background;
using Wino.Core.Domain;
namespace Wino.BackgroundTasks
{
@@ -22,9 +23,8 @@ namespace Wino.BackgroundTasks
var versionText = string.Format("{0}.{1}.{2}.{3}", version.Major, version.Minor, version.Build, version.Revision);
// TODO: Handle with Translator, but it's not initialized here yet.
builder.AddText("Wino Mail is updated!");
builder.AddText(string.Format("New version {0} is ready.", versionText));
builder.AddText(Translator.Notifications_WinoUpdatedTitle);
builder.AddText(string.Format(Translator.Notifications_WinoUpdatedMessage, versionText));
builder.Show();

View File

@@ -0,0 +1,48 @@
using System;
using Microsoft.Extensions.DependencyInjection;
using Serilog;
using Windows.ApplicationModel.Background;
using Windows.Storage;
using Wino.Core;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Services;
using Wino.Core.UWP;
using Wino.Services;
namespace Wino.BackgroundTasks
{
public sealed class SessionConnectedTask : IBackgroundTask
{
public async void Run(IBackgroundTaskInstance taskInstance)
{
var def = taskInstance.GetDeferral();
try
{
var services = new ServiceCollection();
services.RegisterCoreServices();
services.RegisterCoreUWPServices();
var providere = services.BuildServiceProvider();
var backgroundTaskService = providere.GetService<IBackgroundSynchronizer>();
var dbService = providere.GetService<IDatabaseService>();
var logInitializer = providere.GetService<ILogInitializer>();
logInitializer.SetupLogger(ApplicationData.Current.LocalFolder.Path);
await dbService.InitializeAsync();
await backgroundTaskService.RunBackgroundSynchronizationAsync(Core.Domain.Enums.BackgroundSynchronizationReason.SessionConnected);
}
catch (Exception ex)
{
Log.Error(ex, "Background synchronization failed from background task.");
}
finally
{
def.Complete();
}
}
}
}

View File

@@ -18,6 +18,25 @@
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<AllowCrossPlatformRetargeting>false</AllowCrossPlatformRetargeting>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
@@ -38,6 +57,26 @@
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<PlatformTarget>ARM</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<PlatformTarget>ARM</PlatformTarget>
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM64'">
<PlatformTarget>ARM64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
@@ -84,6 +123,7 @@
<ItemGroup>
<Compile Include="AppUpdatedTask.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SessionConnectedTask.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">

View File

@@ -8,11 +8,7 @@
public const string WinoLocalDraftHeader = "X-Wino-Draft-Id";
public const string LocalDraftStartPrefix = "localDraft_";
public const string ToastMailUniqueIdKey = nameof(ToastMailUniqueIdKey);
public const string ToastMailItemIdKey = nameof(ToastMailItemIdKey);
public const string ToastActionKey = nameof(ToastActionKey);
public const string ClientLogFile = "Client_.log";
public const string ServerLogFile = "Server_.log";
public const string LogArchiveFileName = "WinoLogs.zip";
}
}

View File

@@ -8,10 +8,6 @@ namespace Wino.Core.Domain.Entities
[PrimaryKey]
public Guid Id { get; set; }
public string Name { get; set; }
public string HtmlBody { get; set; }
public Guid MailAccountId { get; set; }
}
}

View File

@@ -1,6 +1,6 @@
using System;
using SQLite;
using System;
using System.Collections.Generic;
using SQLite;
namespace Wino.Core.Domain.Entities
{
@@ -9,41 +9,23 @@ namespace Wino.Core.Domain.Entities
/// These values will be inserted during MIME fetch.
/// </summary>
// TODO: This can easily evolve to Contact store, just like People app in Windows 10/11.
// Do it.
public class AccountContact : IEquatable<AccountContact>
public class AddressInformation : IEquatable<AddressInformation>
{
/// <summary>
/// E-mail address of the contact.
/// </summary>
[PrimaryKey]
public string Address { get; set; }
/// <summary>
/// Display name of the contact.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Base64 encoded profile image of the contact.
/// </summary>
public string Base64ContactPicture { get; set; }
/// <summary>
/// All registered accounts have their contacts registered as root.
/// Root contacts must not be overridden by any configuration.
/// They are created on account creation.
/// </summary>
public bool IsRootContact { get; set; }
public string DisplayName => Address == Name ? Address : $"{Name} <{Address}>";
public override bool Equals(object obj)
{
return Equals(obj as AccountContact);
return Equals(obj as AddressInformation);
}
public bool Equals(AccountContact other)
public bool Equals(AddressInformation other)
{
return !(other is null) &&
Address == other.Address &&
@@ -58,12 +40,12 @@ namespace Wino.Core.Domain.Entities
return hashCode;
}
public static bool operator ==(AccountContact left, AccountContact right)
public static bool operator ==(AddressInformation left, AddressInformation right)
{
return EqualityComparer<AccountContact>.Default.Equals(left, right);
return EqualityComparer<AddressInformation>.Default.Equals(left, right);
}
public static bool operator !=(AccountContact left, AccountContact right)
public static bool operator !=(AddressInformation left, AddressInformation right)
{
return !(left == right);
}

View File

@@ -11,10 +11,6 @@ namespace Wino.Core.Domain.Entities
public Guid AccountId { get; set; }
/// <summary>
/// This field is ignored. DisplayName is stored in MailAccount as SenderName from now.
/// </summary>
[Ignore]
public string DisplayName { get; set; }
public string Address { get; set; }
public string IncomingServer { get; set; }
@@ -43,11 +39,11 @@ namespace Wino.Core.Domain.Entities
public string ProxyServer { get; set; }
public string ProxyServerPort { get; set; }
[Obsolete("As 1.7.0")]
public bool IncomingRequiresSSL { get; set; }
/// <summary>
/// Number of concurrent clients that can connect to the server.
/// Default is 5.
/// </summary>
public int MaxConcurrentClients { get; set; }
[Obsolete("As 1.7.0")]
public bool OutgoingRequresSSL { get; set; }
}
}

View File

@@ -20,7 +20,7 @@ namespace Wino.Core.Domain.Entities
/// IMAP is populated by user on setup dialog.
/// </summary>
public string SenderName { get; set; }
public string ProfileName { get; set; }
/// <summary>
/// Account e-mail address.
@@ -40,19 +40,10 @@ namespace Wino.Core.Domain.Entities
public string SynchronizationDeltaIdentifier { get; set; }
/// <summary>
/// TODO: Gets or sets the custom account identifier color in hex.
/// Gets or sets the signature to be used for this account.
/// Null if no signature should be used.
/// </summary>
public string AccountColorHex { get; set; }
/// <summary>
/// Base64 encoded profile picture of the account.
/// </summary>
public string Base64ProfilePictureData { get; set; }
/// <summary>
/// Gets or sets the listing order of the account in the accounts list.
/// </summary>
public int Order { get; set; }
public Guid? SignatureId { get; set; }
/// <summary>
/// Gets or sets whether the account has any reason for an interactive user action to fix continue operating.
@@ -83,15 +74,5 @@ namespace Wino.Core.Domain.Entities
/// </summary>
[Ignore]
public MailAccountPreferences Preferences { get; set; }
/// <summary>
/// Gets whether the account can perform ProfileInformation sync type.
/// </summary>
public bool IsProfileInfoSyncSupported => ProviderType == MailProviderType.Outlook || ProviderType == MailProviderType.Office365 || ProviderType == MailProviderType.Gmail;
/// <summary>
/// Gets whether the account can perform AliasInformation sync type.
/// </summary>
public bool IsAliasSyncSupported => ProviderType == MailProviderType.Gmail;
}
}

View File

@@ -1,56 +0,0 @@
using System;
using SQLite;
namespace Wino.Core.Domain.Entities
{
public class RemoteAccountAlias
{
/// <summary>
/// Display address of the alias.
/// </summary>
public string AliasAddress { get; set; }
/// <summary>
/// Address to be included in Reply-To header when alias is used for sending messages.
/// </summary>
public string ReplyToAddress { get; set; }
/// <summary>
/// Whether this alias is the primary alias for the account.
/// </summary>
public bool IsPrimary { get; set; }
/// <summary>
/// Whether the alias is verified by the server.
/// Only Gmail aliases are verified for now.
/// Non-verified alias messages might be rejected by SMTP server.
/// </summary>
public bool IsVerified { get; set; }
/// <summary>
/// Whether this alias is the root alias for the account.
/// Root alias means the first alias that was created for the account.
/// It can't be deleted or changed.
/// </summary>
public bool IsRootAlias { get; set; }
}
public class MailAccountAlias : RemoteAccountAlias
{
/// <summary>
/// Unique Id for the alias.
/// </summary>
[PrimaryKey]
public Guid Id { get; set; }
/// <summary>
/// Account id that this alias is attached to.
/// </summary>
public Guid AccountId { get; set; }
/// <summary>
/// Root aliases can't be deleted.
/// </summary>
public bool CanDelete => !IsRootAlias;
}
}

View File

@@ -25,25 +25,15 @@ namespace Wino.Core.Domain.Entities
/// </summary>
public bool IsNotificationsEnabled { get; set; }
/// <summary>
/// Gets or sets the custom account identifier color in hex.
/// </summary>
public string AccountColorHex { get; set; }
/// <summary>
/// Gets or sets whether the account has Focused inbox support.
/// Null if the account provider type doesn't support Focused inbox.
/// </summary>
public bool? IsFocusedInboxEnabled { get; set; }
/// <summary>
/// Gets or sets whether signature should be appended automatically.
/// </summary>
public bool IsSignatureEnabled { get; set; }
/// <summary>
/// Gets or sets signature for new messages. Null if signature is not needed.
/// </summary>
public Guid? SignatureIdForNewMessages { get; set; }
/// <summary>
/// Gets or sets signature for following messages. Null if signature is not needed.
/// </summary>
public Guid? SignatureIdForFollowingMessages { get; set; }
}
}

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using SQLite;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.MailItem;
@@ -108,12 +107,6 @@ namespace Wino.Core.Domain.Entities
/// </summary>
public string DraftId { get; set; }
/// <summary>
/// Whether this mail is only created locally.
/// </summary>
[Ignore]
public bool IsLocalDraft => !string.IsNullOrEmpty(DraftId) && DraftId.StartsWith(Constants.LocalDraftStartPrefix);
/// <summary>
/// Whether this copy is draft or not.
/// </summary>
@@ -142,15 +135,6 @@ namespace Wino.Core.Domain.Entities
[Ignore]
public MailAccount AssignedAccount { get; set; }
/// <summary>
/// Contact information of the sender if exists.
/// Warning: This field is not populated by queries.
/// Services or View Models are responsible for populating this field.
/// </summary>
[Ignore]
public AccountContact SenderContact { get; set; }
public IEnumerable<Guid> GetContainingIds() => [UniqueId];
public override string ToString() => $"{Subject} <-> {Id}";
}
}

View File

@@ -67,9 +67,6 @@ namespace Wino.Core.Domain.Entities
return false;
}
public static MailItemFolder CreateMoreFolder() => new MailItemFolder() { IsSticky = true, SpecialFolderType = SpecialFolderType.More, FolderName = Translator.MoreFolderNameOverride };
public static MailItemFolder CreateCategoriesFolder() => new MailItemFolder() { IsSticky = true, SpecialFolderType = SpecialFolderType.Category, FolderName = Translator.CategoriesFolderNameOverride };
public override string ToString() => FolderName;
}
}

View File

@@ -11,10 +11,6 @@ namespace Wino.Core.Domain.Entities
public Guid AccountId { get; set; }
/// <summary>
/// Unique object storage for authenticators if needed.
/// </summary>
public string UniqueId { get; set; }
public string Address { get; set; }
public void RefreshTokens(TokenInformationBase tokenInformationBase)

View File

@@ -9,7 +9,6 @@
ManuelSetupWaiting,
TestingConnection,
AutoDiscoverySetup,
AutoDiscoveryInProgress,
FetchingProfileInformation
AutoDiscoveryInProgress
}
}

View File

@@ -11,10 +11,6 @@
Czech,
Chinese,
Spanish,
French,
Indonesian,
Greek,
PortugeseBrazil,
Italian
French
}
}

View File

@@ -0,0 +1,11 @@
namespace Wino.Core.Domain.Enums
{
public enum EditorToolbarSectionType
{
None,
Format,
Insert,
Draw,
Options
}
}

View File

@@ -5,7 +5,6 @@
All,
Unread,
Flagged,
Mentions,
Files
Mentions
}
}

View File

@@ -11,10 +11,7 @@
ChangeFlag,
AlwaysMoveTo,
MoveToFocused,
Archive,
RenameFolder,
EmptyFolder,
MarkFolderRead,
RenameFolder
}
// UI requests
@@ -47,7 +44,6 @@
DarkEditor,
LightEditor,
Print,
DiscardLocalDraft,
Navigate // For toast activation
}
}

View File

@@ -0,0 +1,8 @@
namespace Wino.Core.Domain.Enums
{
public enum MenuPaneMode
{
Visible,
Hidden
}
}

View File

@@ -0,0 +1,15 @@
namespace Wino.Core.Domain.Enums
{
public enum ReaderFont
{
Arial,
TimesNewRoman,
Verdana,
Tahoma,
CourierNew,
Georgia,
TrebuchetMS,
Calibri,
Helvetica
}
}

View File

@@ -1,12 +0,0 @@
namespace Wino.Core.Domain.Enums
{
/// <summary>
/// What should happen to server app when the client is terminated.
/// </summary>
public enum ServerBackgroundMode
{
MinimizedTray, // Still runs, tray icon is visible.
Invisible, // Still runs, tray icon is invisible.
Terminate // Server is terminated as Wino terminates.
}
}

View File

@@ -1,11 +0,0 @@
namespace Wino.Core.Domain.Enums
{
public enum StartupBehaviorResult
{
Enabled,
Disabled,
DisabledByUser,
DisabledByPolicy,
Fatal
}
}

View File

@@ -1,12 +0,0 @@
namespace Wino.Core.Domain.Enums
{
/// <summary>
/// Enumeration for the source of synchronization.
/// Right now it can either be from the client or the server.
/// </summary>
public enum SynchronizationSource
{
Client,
Server
}
}

View File

@@ -4,10 +4,8 @@
{
FoldersOnly, // Only synchronize folder metadata.
ExecuteRequests, // Run the queued requests, and then synchronize if needed.
Inbox, // Only Inbox, Sent and Draft folders.
Inbox, // Only Inbox
Custom, // Only sync folders that are specified in the options.
Full, // Synchronize all folders. This won't update profile or alias information.
UpdateProfile, // Only update profile information
Alias, // Only update alias information
Full, // Synchronize everything
}
}

View File

@@ -1,10 +0,0 @@
namespace Wino.Core.Domain.Enums
{
public enum WinoCustomMessageDialogIcon
{
Information,
Warning,
Error,
Question
}
}

View File

@@ -19,10 +19,7 @@
PersonalizationPage,
MessageListPage,
MailListPage,
ReadComposePanePage,
LanguageTimePage,
AppPreferencesPage,
SettingOptionsPage,
AliasManagementPage
ReadingPanePage,
SettingOptionsPage
}
}

View File

@@ -1,11 +0,0 @@
namespace Wino.Core.Domain.Enums
{
public enum WinoServerConnectionStatus
{
None,
Connecting,
Connected,
Disconnected,
Failed
}
}

View File

@@ -0,0 +1,9 @@
using System;
namespace Wino.Core.Domain.Exceptions
{
/// <summary>
/// An exception thrown when the background task execution policies are denied for some reason.
/// </summary>
public class BackgroundTaskExecutionRequestDeniedException : Exception { }
}

View File

@@ -4,11 +4,8 @@ namespace Wino.Core.Domain.Exceptions
{
public class ImapClientPoolException : Exception
{
public ImapClientPoolException(Exception innerException, string protocolLog) : base(Translator.Exception_ImapClientPoolFailed, innerException)
public ImapClientPoolException(Exception innerException) : base(Translator.Exception_ImapClientPoolFailed, innerException)
{
ProtocolLog = protocolLog;
}
public string ProtocolLog { get; }
}
}

View File

@@ -1,21 +0,0 @@
using System;
using Wino.Core.Domain.Models.AutoDiscovery;
namespace Wino.Core.Domain.Exceptions
{
public class ImapConnectionFailedPackage
{
public ImapConnectionFailedPackage(Exception error, string protocolLog, AutoDiscoverySettings settings)
{
Error = error;
ProtocolLog = protocolLog;
Settings = settings;
}
public AutoDiscoverySettings Settings { get; }
public Exception Error { get; }
public string ProtocolLog { get; }
public string GetErrorMessage() => Error.InnerException == null ? Error.Message : Error.InnerException.Message;
}
}

View File

@@ -1,7 +0,0 @@
namespace Wino.Core.Domain.Exceptions
{
public class MissingAliasException : System.Exception
{
public MissingAliasException() : base(Translator.Exception_MissingAlias) { }
}
}

View File

@@ -1,12 +0,0 @@
using System;
namespace Wino.Core.Domain.Exceptions
{
/// <summary>
/// All server crash types. Wino Server ideally should not throw anything else than this Exception type.
/// </summary>
public class WinoServerException : Exception
{
public WinoServerException(string message) : base(message) { }
}
}

View File

@@ -1,20 +0,0 @@
using System;
namespace Wino.Core.Domain.Extensions
{
public static class MimeExtensions
{
public static string GetBase64MimeMessage(this MimeKit.MimeMessage message)
{
using System.IO.MemoryStream memoryStream = new();
message.WriteTo(MimeKit.FormatOptions.Default, memoryStream);
byte[] buffer = memoryStream.GetBuffer();
int count = (int)memoryStream.Length;
return Convert.ToBase64String(buffer);
}
public static MimeKit.MimeMessage GetMimeMessageFromBase64(this string base64)
=> MimeKit.MimeMessage.Load(new System.IO.MemoryStream(Convert.FromBase64String(base64)));
}
}

View File

@@ -5,17 +5,9 @@ namespace Wino.Core.Domain.Interfaces
{
public interface IAccountMenuItem : IMenuItem
{
bool IsEnabled { get; set; }
double SynchronizationProgress { get; set; }
int UnreadItemCount { get; set; }
IEnumerable<MailAccount> HoldingAccounts { get; }
void UpdateAccount(MailAccount account);
}
public interface IMergedAccountMenuItem : IAccountMenuItem
{
int MergedAccountCount { get; }
MergedInbox Parameter { get; }
}
}

View File

@@ -13,26 +13,5 @@ namespace Wino.Core.Domain.Interfaces
/// Name representation of the view model that will be used to identify the startup entity on launch.
/// </summary>
string StartupEntityTitle { get; }
/// <summary>
/// E-mail addresses that this account holds.
/// </summary>
string StartupEntityAddresses { get; }
/// <summary>
/// Represents the account order in the accounts list.
/// </summary>
int Order { get; }
/// <summary>
/// Provider details of the account.
/// </summary>
IProviderDetail ProviderDetail { get; set; }
/// <summary>
/// How many accounts this provider has.
/// </summary>
int HoldingAccountCount { get; }
}
}

View File

@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Models.Accounts;
namespace Wino.Core.Domain.Interfaces
{
@@ -69,91 +68,12 @@ namespace Wino.Core.Domain.Interfaces
/// <returns>Current account synchronization modifier.</returns>
Task<string> UpdateSynchronizationIdentifierAsync(Guid accountId, string newIdentifier);
/// <summary>
/// Renames the merged inbox with the given id.
/// </summary>
/// <param name="mergedInboxId">Merged Inbox id</param>
/// <param name="newName">New name for the merged/linked inbox.</param>
Task RenameMergedAccountAsync(Guid mergedInboxId, string newName);
/// <summary>
/// Creates a new merged inbox with the given accounts.
/// </summary>
/// <param name="mergedInbox">Merged inbox properties.</param>
/// <param name="accountsToMerge">List of accounts to merge together.</param>
Task CreateMergeAccountsAsync(MergedInbox mergedInbox, IEnumerable<MailAccount> accountsToMerge);
/// <summary>
/// Updates the merged inbox with the given id with the new linked accounts.
/// </summary>
/// <param name="mergedInboxId">Updating merged inbox id.</param>
/// <param name="linkedAccountIds">List of linked account ids.</param>
Task UpdateMergedInboxAsync(Guid mergedInboxId, IEnumerable<Guid> linkedAccountIds);
/// <summary>
/// Destroys the merged inbox with the given id.
/// </summary>
/// <param name="mergedInboxId">Merged inbox id to destroy.</param>
Task UnlinkMergedInboxAsync(Guid mergedInboxId);
/// <summary>
/// Updates the account listing orders.
/// </summary>
/// <param name="accountIdOrderPair">AccountId-OrderNumber pair for all accounts.</param>
Task UpdateAccountOrdersAsync(Dictionary<Guid, int> accountIdOrderPair);
/// <summary>
/// Returns the account aliases.
/// </summary>
/// <param name="accountId">Account id.</param>
/// <returns>A list of MailAccountAlias that has e-mail aliases.</returns>
Task<List<MailAccountAlias>> GetAccountAliasesAsync(Guid accountId);
/// <summary>
/// Updated account's aliases.
/// </summary>
/// <param name="accountId">Account id to update aliases for.</param>
/// <param name="aliases">Full list of updated aliases.</param>
/// <returns></returns>
Task UpdateAccountAliasesAsync(Guid accountId, List<MailAccountAlias> aliases);
/// <summary>
/// Delete account alias.
/// </summary>
/// <param name="aliasId">Alias to remove.</param>
Task DeleteAccountAliasAsync(Guid aliasId);
/// <summary>
/// Updated profile information of the account.
/// </summary>
/// <param name="accountId">Account id to update info for.</param>
/// <param name="profileInformation">Info data.</param>
/// <returns></returns>
Task UpdateProfileInformationAsync(Guid accountId, ProfileInformation profileInformation);
/// <summary>
/// Creates a root + primary alias for the account.
/// This is only called when the account is created.
/// </summary>
/// <param name="accountId">Account id.</param>
/// <param name="address">Address to create root primary alias from.</param>
Task CreateRootAliasAsync(Guid accountId, string address);
/// <summary>
/// Will compare local-remote aliases and update the local ones or add/delete new ones.
/// </summary>
/// <param name="remoteAccountAliases">Remotely fetched basic alias info from synchronizer.</param>
/// <param name="account">Account to update remote aliases for..</param>
Task UpdateRemoteAliasInformationAsync(MailAccount account, List<RemoteAccountAlias> remoteAccountAliases);
/// <summary>
/// Gets the primary account alias for the given account id.
/// Used when creating draft messages.
/// </summary>
/// <param name="accountId">Account id.</param>
/// <returns>Primary alias for the account.</returns>
Task<MailAccountAlias> GetPrimaryAccountAliasAsync(Guid accountId);
}
}

View File

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

View File

@@ -1,21 +0,0 @@
namespace Wino.Core.Domain.Interfaces
{
/// <summary>
/// Singleton object that holds the application data folder path and the publisher shared folder path.
/// Load the values before calling any service.
/// App data folder is used for storing files.
/// Pubhlisher cache folder is only used for database file so other apps can access it in the same package by same publisher.
/// </summary>
public interface IApplicationConfiguration
{
/// <summary>
/// Application data folder.
/// </summary>
string ApplicationDataFolderPath { get; set; }
/// <summary>
/// Publisher shared folder path.
/// </summary>
string PublisherSharedFolderPath { get; set; }
}
}

View File

@@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Enums;
@@ -22,12 +23,28 @@ namespace Wino.Core.Domain.Interfaces
/// <summary>
/// Initial creation of token. Requires user interaction.
/// This will cache the token but still returns for account creation
/// 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>

View File

@@ -1,6 +0,0 @@
namespace Wino.Core.Domain.Interfaces
{
public interface IOutlookAuthenticator : IAuthenticator { }
public interface IGmailAuthenticator : IAuthenticator { }
public interface IImapAuthenticator : IAuthenticator { }
}

View File

@@ -5,14 +5,15 @@ namespace Wino.Core.Domain.Interfaces
public interface IBackgroundTaskService
{
/// <summary>
/// Unregisters all background tasks once.
/// This is used to clean up the background tasks when the app is updated.
/// Manages background task registrations, requests access if needed, checks the statusses of them etc.
/// </summary>
void UnregisterAllBackgroundTask();
/// <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>
/// Registers required background tasks.
/// Unregisters all existing background tasks. Useful for migrations.
/// </summary>
Task RegisterBackgroundTasksAsync();
void UnregisterAllBackgroundTask();
}
}

View File

@@ -1,62 +0,0 @@
using System.Threading;
using System.Threading.Tasks;
using MailKit;
using Wino.Core.Domain.Entities;
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 IBaseSynchronizer
{
/// <summary>
/// Account that is assigned for this synchronizer.
/// </summary>
MailAccount Account { get; }
/// <summary>
/// Synchronizer state.
/// </summary>
AccountSynchronizerState State { get; }
/// <summary>
/// Queues a single request to be executed in the next synchronization.
/// </summary>
/// <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>
/// 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.
/// </summary>
/// <param name="options">Options for synchronization.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>Result summary of synchronization.</returns>
Task<SynchronizationResult> SynchronizeAsync(SynchronizationOptions options, CancellationToken cancellationToken = default);
/// <summary>
/// Synchronizes profile information with the server.
/// Sender name and Profile picture are updated.
/// </summary>
/// <returns>Profile information model that holds the values.</returns>
Task<ProfileInformation> GetProfileInformationAsync();
/// <summary>
/// Downloads a single MIME message from the server and saves it to disk.
/// </summary>
/// <param name="mailItem">Mail item to download from server.</param>
/// <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);
}
}

View File

@@ -1,8 +0,0 @@
namespace Wino.Core.Domain.Interfaces
{
/// <summary>
/// All messages that Client sends to Server and awaits a response in return.
/// For example; triggering a new synchronization request.
/// </summary>
public interface IClientMessage;
}

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

@@ -1,9 +0,0 @@
using Wino.Core.Domain.Entities;
namespace Wino.Core.Domain.Interfaces
{
public interface ICreateAccountAliasDialog
{
public MailAccountAlias CreatedAccountAlias { get; set; }
}
}

View File

@@ -15,11 +15,5 @@ namespace Wino.Core.Domain.Interfaces
/// Displays preparing folders page.
/// </summary>
void ShowPreparingFolders();
/// <summary>
/// Updates account properties for the welcome imap setup dialog and starts the setup.
/// </summary>
/// <param name="account">Account properties.</param>
void StartImapConnectionSetup(MailAccount account);
}
}

View File

@@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Accounts;
using Wino.Core.Domain.Models.Folders;
namespace Wino.Core.Domain.Interfaces
@@ -15,10 +13,11 @@ namespace Wino.Core.Domain.Interfaces
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, WinoCustomMessageDialogIcon icon);
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);
@@ -26,19 +25,12 @@ namespace Wino.Core.Domain.Interfaces
// Custom dialogs
Task<IMailItemFolder> ShowMoveMailFolderDialogAsync(List<IMailItemFolder> availableFolders);
Task<AccountCreationDialogResult> ShowNewAccountMailProviderDialogAsync(List<IProviderDetail> availableProviders);
Task<Tuple<string, MailProviderType>> ShowNewAccountMailProviderDialogAsync(List<IProviderDetail> availableProviders);
IAccountCreationDialog GetAccountCreationDialog(MailProviderType type);
Task<string> ShowTextInputDialogAsync(string currentInput, string dialogTitle, string dialogDescription, string primaryButtonText);
Task<string> ShowTextInputDialogAsync(string currentInput, string dialogTitle, string dialogDescription);
Task<MailAccount> ShowEditAccountDialogAsync(MailAccount account);
Task<MailAccount> ShowAccountPickerDialogAsync(List<MailAccount> availableAccounts);
/// <summary>
/// Displays a dialog to the user for reordering accounts.
/// </summary>
/// <param name="availableAccounts">Available accounts in order.</param>
/// <returns>Result model that has dict of AccountId-AccountOrder.</returns>
Task ShowAccountReorderDialogAsync(ObservableCollection<IAccountProviderDetailViewModel> availableAccounts);
/// <summary>
/// Presents a dialog to the user for selecting folder.
/// </summary>
@@ -46,23 +38,5 @@ namespace Wino.Core.Domain.Interfaces
/// <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);
/// <summary>
/// Presents a dialog to the user for signature creation/modification.
/// </summary>
/// <returns>Signature information. Null if canceled.</returns>
Task<AccountSignature> ShowSignatureEditorDialog(AccountSignature signatureModel = null);
/// <summary>
/// Presents a dialog to the user for account alias creation/modification.
/// </summary>
/// <returns>Created alias model if not canceled.</returns>
Task<ICreateAccountAliasDialog> ShowCreateAccountAliasDialogAsync();
Task<bool> ShowWinoCustomMessageDialogAsync(string title,
string description,
string approveButtonText,
WinoCustomMessageDialogIcon? icon,
string cancelButtonText = "",
string dontAskAgainConfigurationKey = "");
}
}

View File

@@ -8,13 +8,5 @@ namespace Wino.Core.Domain.Interfaces
Task<string> CopyFileAsync(string sourceFilePath, string destinationFolderPath);
Task<Stream> GetFileStreamAsync(string folderPath, string fileName);
Task<string> GetFileContentByApplicationUriAsync(string resourcePath);
/// <summary>
/// Zips all existing logs and saves to picked destination folder.
/// </summary>
/// <param name="logsFolder">Folder path where logs are stored.</param>
/// <param name="destinationFolder">Target path to save the archive file.</param>
/// <returns>True if zip is created with at least one item, false if logs are not found.</returns>
Task<bool> SaveLogsToFolderAsync(string logsFolder, string destinationFolder);
}
}

View File

@@ -8,7 +8,6 @@ namespace Wino.Core.Domain.Interfaces
public interface IFolderMenuItem : IBaseFolderMenuItem
{
MailAccount ParentAccount { get; }
void UpdateParentAccounnt(MailAccount account);
}
public interface IMergedAccountFolderMenuItem : IBaseFolderMenuItem { }
@@ -20,7 +19,6 @@ namespace Wino.Core.Domain.Interfaces
int UnreadItemCount { get; set; }
SpecialFolderType SpecialFolderType { get; }
IEnumerable<IMailItemFolder> HandlingFolders { get; }
IEnumerable<IMenuItem> SubMenuItems { get; }
bool IsMoveTarget { get; }
bool IsSticky { get; }
bool IsSystemFolder { get; }

View File

@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Accounts;
using Wino.Core.Domain.Models.Folders;
using Wino.Core.Domain.Models.MailItem;
using Wino.Core.Domain.Models.Synchronization;
@@ -16,10 +15,13 @@ namespace Wino.Core.Domain.Interfaces
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);
@@ -37,6 +39,25 @@ namespace Wino.Core.Domain.Interfaces
/// </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>
@@ -66,29 +87,6 @@ namespace Wino.Core.Domain.Interfaces
/// <returns>True if Inbox exists, False if not.</returns>
Task<bool> IsInboxAvailableForAccountAsync(Guid accountId);
/// <summary>
/// Updates folder's LastSynchronizedDate to now.
/// </summary>
/// <param name="folderId">Folder to update.</param>
Task UpdateFolderLastSyncDateAsync(Guid folderId);
/// <summary>
/// Updates the given folder.
/// </summary>
/// <param name="folder">Folder to update.</param>
Task UpdateFolderAsync(MailItemFolder folder);
/// <summary>
/// Returns the active folder menu items for the given account for UI.
/// </summary>
/// <param name="accountMenuItem">Account to get folder menu items for.</param>
Task<IEnumerable<IMenuItem>> GetAccountFoldersForDisplayAsync(IAccountMenuItem accountMenuItem);
/// <summary>
/// Returns a list of unread item counts for the given account ids.
/// Every folder that is marked as show unread badge is included.
/// </summary>
/// <param name="accountIds">Account ids to get unread folder counts for.</param>
Task<List<UnreadItemCountResult>> GetUnreadItemCountResultsAsync(IEnumerable<Guid> accountIds);
Task TestAsync();
}
}

View File

@@ -1,16 +1,16 @@
using System.Collections.Generic;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Reader;
namespace Wino.Core.Domain.Interfaces
{
/// <summary>
/// Service to access available fonts.
/// </summary>
public interface IFontService
{
/// <summary>
/// Get available fonts. Default + installed system fonts.
/// Fonts initialized only once. To refresh fonts, restart the application.
/// </summary>
List<string> GetFonts();
List<ReaderFontModel> GetReaderFonts();
ReaderFontModel GetCurrentReaderFont();
int GetCurrentReaderFontSize();
void ChangeReaderFont(ReaderFont font);
void ChangeReaderFontSize(int size);
}
}

View File

@@ -1,16 +1,10 @@
using Wino.Core.Domain.Models.Launch;
using System.Collections.Specialized;
namespace Wino.Core.Domain.Interfaces;
public interface ILaunchProtocolService
namespace Wino.Core.Domain.Interfaces
{
/// <summary>
/// Used to handle toasts.
/// </summary>
object LaunchParameter { get; set; }
/// <summary>
/// Used to handle mailto links.
/// </summary>
MailToUri MailToUri { get; set; }
public interface ILaunchProtocolService
{
object LaunchParameter { get; set; }
NameValueCollection MailtoParameters { get; set; }
}
}

View File

@@ -2,7 +2,7 @@
{
public interface ILogInitializer
{
void SetupLogger(string fullLogFilePath);
void SetupLogger(string logFolderPath);
void RefreshLoggingLevel();
}

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MimeKit;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Models.MailItem;
@@ -11,7 +11,12 @@ namespace Wino.Core.Domain.Interfaces
{
Task<MailCopy> GetSingleMailItemAsync(string mailCopyId, string remoteFolderId);
Task<MailCopy> GetSingleMailItemAsync(Guid uniqueMailId);
Task<List<IMailItem>> FetchMailsAsync(MailListInitializationOptions options, CancellationToken cancellationToken = default);
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.
@@ -43,12 +48,15 @@ namespace Wino.Core.Domain.Interfaces
/// <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>
@@ -69,43 +77,5 @@ namespace Wino.Core.Domain.Interfaces
/// <param name="uniqueMailId">Unique id of the mail item.</param>
/// <returns>Account that mail belongs to.</returns>
Task<MailAccount> GetMailAccountByUniqueIdAsync(Guid uniqueMailId);
/// <summary>
/// Checks whether the given mail copy id exists in the database.
/// Safely used for Outlook to prevent downloading the same mail twice.
/// For Gmail, it should be avoided since one mail may belong to multiple folders.
/// </summary>
/// <param name="mailCopyId">Native mail id of the message.</param>
Task<bool> IsMailExistsAsync(string mailCopyId);
/// <summary>
/// Returns all mails for given folder id.
/// </summary>
/// <param name="folderId">Folder id to get mails for</param>
Task<List<MailCopy>> GetMailsByFolderIdAsync(Guid folderId);
/// <summary>
/// Returns all unread mails for given folder id.
/// </summary>
/// <param name="folderId">Folder id to get unread mails for.</param>
Task<List<MailCopy>> GetUnreadMailsByFolderIdAsync(Guid folderId);
/// <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.
/// </summary>
/// <param name="mailCopyId">MailCopy id</param>
/// <param name="folderId">Folder's local id.</param>
/// <returns>Whether mail exists in the folder or not.</returns>
Task<bool> IsMailExistsAsync(string mailCopyId, Guid folderId);
/// <summary>
/// Creates a draft MailCopy and MimeMessage based on the given options.
/// For forward/reply it would include the referenced message.
/// </summary>
/// <param name="accountId">AccountId which should have new draft.</param>
/// <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);
}
}

View File

@@ -8,23 +8,9 @@ namespace Wino.Core.Domain.Interfaces
{
string GetWebAuthenticationBrokerUri();
Task<string> GetMimeMessageStoragePath();
Task<string> GetEditorBundlePathAsync();
Task<string> GetQuillEditorBundlePathAsync();
Task LaunchFileAsync(string filePath);
Task LaunchUriAsync(Uri uri);
/// <summary>
/// Launches the default browser with the specified uri and waits for protocol activation to finish.
/// </summary>
/// <param name="authenticator"></param>
/// <returns>Response callback from the browser.</returns>
Task<Uri> GetAuthorizationResponseUriAsync(IAuthenticator authenticator, string authorizationUri);
/// <summary>
/// Finalizes GetAuthorizationResponseUriAsync for current IAuthenticator.
/// </summary>
/// <param name="authorizationResponseUri"></param>
void ContinueAuthorization(Uri authorizationResponseUri);
bool IsAppRunning();
string GetFullAppVersion();
@@ -35,11 +21,5 @@ namespace Wino.Core.Domain.Interfaces
/// Some cryptographic shit is needed for requesting Google authentication in UWP.
/// </summary>
GoogleAuthorizationRequest GetGoogleAuthorizationRequest();
/// <summary>
/// Gets or sets the function that returns a pointer for main window hwnd for UWP.
/// This is used to display WAM broker dialog on running UWP app called by a windowless server code.
/// </summary>
Func<IntPtr> GetCoreWindowHwnd { get; set; }
}
}

View File

@@ -122,25 +122,15 @@ namespace Wino.Core.Domain.Interfaces
AppLanguage CurrentLanguage { get; set; }
/// <summary>
/// Setting: Display font for the mail reader.
/// Setting: Display font for the mail reader. Not composer.
/// </summary>
string ReaderFont { get; set; }
ReaderFont ReaderFont { get; set; }
/// <summary>
/// Setting: Font size for the mail reader.
/// Setting: Font size for the mail reader. Not composer.
/// </summary>
int ReaderFontSize { get; set; }
/// <summary>
/// Setting: Display font for the mail composer.
/// </summary>
string ComposerFont { get; set; }
/// <summary>
/// Setting: Font size for the mail composer.
/// </summary>
int ComposerFontSize { get; set; }
/// <summary>
/// Setting: Whether the navigation pane is opened on the last session or not.
/// </summary>
@@ -150,10 +140,5 @@ namespace Wino.Core.Domain.Interfaces
/// Setting: Whether the next item should be automatically selected once the current item is moved or removed.
/// </summary>
bool AutoSelectNextItem { get; set; }
/// <summary>
/// Setting: Gets or sets what should happen to server app when the client is terminated.
/// </summary>
ServerBackgroundMode ServerTerminationBehavior { get; set; }
}
}

View File

@@ -22,7 +22,7 @@ namespace Wino.Core.Domain.Interfaces
TRequest NativeRequest { get; }
}
public interface IRequestBase : IClientMessage
public interface IRequestBase
{
/// <summary>
/// Synchronizer option to perform.
@@ -40,15 +40,6 @@ namespace Wino.Core.Domain.Interfaces
/// Reverts the UI changes applied by <see cref="ApplyUIChanges"/> if the request fails.
/// </summary>
void RevertUIChanges();
/// <summary>
/// Whether synchronizations should be delayed after executing this request.
/// Specially Outlook sometimes don't report changes back immidiately after sending the API request.
/// This results following synchronization to miss the changes.
/// We add small delay for the following synchronization after executing current requests to overcome this issue.
/// Default is false.
/// </summary>
int ResynchronizationDelay { get; }
}
public interface IRequest : IRequestBase

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Wino.Core.Domain.Entities;
@@ -8,40 +7,27 @@ namespace Wino.Core.Domain.Interfaces
public interface ISignatureService
{
/// <summary>
/// Get one signature by Id.
/// Returns the assigned account signature for the account.
/// </summary>
/// <param name="signatureId">Signature Id.</param>
Task<AccountSignature> GetSignatureAsync(Guid signatureId);
/// <param name="accountId"></param>
/// <returns></returns>
Task<AccountSignature> GetAccountSignatureAsync(Guid accountId);
/// <summary>
/// Returns all signatures for specified account.
/// Creates the initial signature for new created accounts.
/// </summary>
/// <param name="accountId">Account id</param>
Task<List<AccountSignature>> GetSignaturesAsync(Guid accountId);
/// <summary>
/// Creates a new signature for the account.
/// </summary>
/// <param name="signature">Signature that should be created. It should contain ID and account to which it belongs.</param>
Task<AccountSignature> CreateSignatureAsync(AccountSignature signature);
/// <summary>
/// Creates a default Wino signature for the account.
/// Needed only for initial account setup.
/// </summary>
/// <param name="accountId">Account Id.</param>
/// <param name="accountId"></param>
/// <returns></returns>
Task<AccountSignature> CreateDefaultSignatureAsync(Guid accountId);
/// <summary>
/// Updates existing signature.
/// Updates account's existing signature with the given HTML signature.
/// </summary>
/// <param name="signature">Signature that should be updated. It should contain ID and account to which it belongs.</param>
Task<AccountSignature> UpdateSignatureAsync(AccountSignature signature);
Task<AccountSignature> UpdateAccountSignatureAsync(Guid accountId, string htmlBody);
/// <summary>
/// Deletes existing signature.
/// Disabled signature for the account and deletes existing signature.
/// </summary>
/// <param name="signature">Signature that should be deleted.</param>
Task<AccountSignature> DeleteSignatureAsync(AccountSignature signature);
Task DeleteAccountSignatureAssignment(Guid accountId);
}
}

View File

@@ -1,20 +0,0 @@
using System.Threading.Tasks;
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Interfaces
{
public interface IStartupBehaviorService
{
/// <summary>
/// Gets whether Wino Server is set to launch on startup or not.
/// </summary>
Task<StartupBehaviorResult> GetCurrentStartupBehaviorAsync();
/// <summary>
/// Enables/disables the current startup behavior for Wino Server.
/// </summary>
/// <param name="isEnabled">Whether to launch enabled or disabled.</param>
/// <returns>True if operation success, false if not.</returns>
Task<StartupBehaviorResult> ToggleStartupBehavior(bool isEnabled);
}
}

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,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

@@ -1,11 +0,0 @@
using System;
using System.Threading.Tasks;
namespace Wino.Core.Domain.Interfaces
{
public interface ISynchronizerFactory
{
Task<IBaseSynchronizer> GetAccountSynchronizerAsync(Guid accountId);
Task InitializeAsync();
}
}

View File

@@ -7,11 +7,6 @@ namespace Wino.Core.Domain.Interfaces
{
public interface IThreadingStrategy
{
/// <summary>
/// Attach thread mails to the list.
/// </summary>
/// <param name="items">Original mails.</param>
/// <returns>Original mails with thread mails.</returns>
Task<List<IMailItem>> ThreadItemsAsync(List<MailCopy> items);
bool ShouldThreadWithItem(IMailItem originalItem, IMailItem targetItem);
}

View File

@@ -1,15 +0,0 @@
using System.Threading.Tasks;
using Wino.Core.Domain.Models.Reader;
namespace Wino.Core.Domain.Interfaces
{
public interface IUnsubscriptionService
{
/// <summary>
/// Unsubscribes from the subscription using one-click method.
/// </summary>
/// <param name="info">Unsubscribtion information.</param>
/// <returns>Whether the unsubscription is succeeded or not.</returns>
Task<bool> OneClickUnsubscribeAsync(UnsubscribeInfo info);
}
}

View File

@@ -1,4 +1,5 @@
using System.Threading.Tasks;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Folders;
using Wino.Core.Domain.Models.MailItem;
@@ -16,7 +17,7 @@ namespace Wino.Core.Domain.Interfaces
/// Queues new draft creation request for synchronizer.
/// </summary>
/// <param name="draftPreperationRequest">A class that holds the parameters for creating a draft.</param>
Task ExecuteAsync(DraftPreparationRequest draftPreperationRequest);
Task ExecuteAsync(DraftPreperationRequest draftPreperationRequest);
/// <summary>
/// Queues a new request for synchronizer to send a draft.
@@ -27,7 +28,8 @@ namespace Wino.Core.Domain.Interfaces
/// <summary>
/// Prepares requires IRequest collection for folder actions and executes them via proper synchronizers.
/// </summary>
/// <param name="folderOperationPreperationRequest">Folder prep request.</param>
Task ExecuteAsync(FolderOperationPreperationRequest folderOperationPreperationRequest);
/// <param name="operation">Folder operation to execute.</param>
/// <param name="folderStructure">Target folder</param>
Task ExecuteAsync(FolderOperation operation, IMailItemFolder folderStructure);
}
}

View File

@@ -1,18 +1,15 @@
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
{
/// <summary>
/// Prepares proper folder action requests for synchronizers to execute.
/// </summary>
/// <param name="request"></param>
/// <returns>Base request that synchronizer can execute.</returns>
Task<IRequestBase> PrepareFolderRequestAsync(FolderOperationPreperationRequest request);
Task<IRequest> PrepareFolderRequestAsync(FolderOperation operation, IMailItemFolder mailItemFolder);
/// <summary>
/// Prepares proper Wino requests for synchronizers to execute categorized by AccountId and FolderId.
@@ -20,7 +17,6 @@ namespace Wino.Core.Domain.Interfaces
/// <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>
/// <returns>Base request that synchronizer can execute.</returns>
Task<List<IRequest>> PrepareRequestsAsync(MailOperationPreperationRequest request);
}
}

View File

@@ -1,61 +0,0 @@
using System;
using System.Threading.Tasks;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Server;
namespace Wino.Core.Domain.Interfaces
{
public interface IWinoServerConnectionManager
{
/// <summary>
/// When the connection status changes, this event will be triggered.
/// </summary>
event EventHandler<WinoServerConnectionStatus> StatusChanged;
/// <summary>
/// Gets the connection status.
/// </summary>
WinoServerConnectionStatus Status { get; }
/// <summary>
/// Launches Full Trust process (Wino Server) and awaits connection completion.
/// If connection is not established in 10 seconds, it will return false.
/// If the server process is already running, it'll connect to existing one.
/// If the server process is not running, it'll be launched and connection establishment is awaited.
/// </summary>
/// <returns>Whether connection is established or not.</returns>
Task<bool> ConnectAsync();
/// <summary>
/// Queues a new user request to be processed by Wino Server.
/// Healthy connection must present before calling this method.
/// </summary>
/// <param name="request">Request to queue for synchronizer in the server.</param>
/// <param name="accountId">Account id to queueu request for.</param>
Task QueueRequestAsync(IRequestBase request, Guid accountId);
/// <summary>
/// Returns response from server for the given request.
/// </summary>
/// <typeparam name="TResponse">Response type.</typeparam>
/// <typeparam name="TRequestType">Request type.</typeparam>
/// <param name="clientMessage">Request type.</param>
/// <returns>Response received from the server for the given TResponse type.</returns>
Task<WinoServerResponse<TResponse>> GetResponseAsync<TResponse, TRequestType>(TRequestType clientMessage) where TRequestType : IClientMessage;
/// <summary>
/// Handle for connecting to the server.
/// If the server is already running, it'll connect to existing one.
/// Callers can await this handle to wait for connection establishment.
/// </summary>
TaskCompletionSource<bool> ConnectingHandle { get; }
}
public interface IWinoServerConnectionManager<TAppServiceConnection> : IWinoServerConnectionManager, IInitializeAsync
{
/// <summary>
/// Existing connection handle to the server of TAppServiceConnection type.
/// </summary>
TAppServiceConnection Connection { get; set; }
}
}

View File

@@ -1,11 +0,0 @@
using System;
using Wino.Core.Domain.Entities;
namespace Wino.Core.Domain.Interfaces
{
public interface IWinoSynchronizerFactory : IInitializeAsync
{
IBaseSynchronizer GetAccountSynchronizer(Guid accountId);
IBaseSynchronizer CreateNewSynchronizer(MailAccount account);
}
}

View File

@@ -1,6 +0,0 @@
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Models.Accounts
{
public record AccountCreationDialogResult(MailProviderType ProviderType, string AccountName, string AccountColorHex = "");
}

View File

@@ -1,9 +0,0 @@
namespace Wino.Core.Domain.Models.Accounts
{
/// <summary>
/// Encapsulates the profile information of an account.
/// </summary>
/// <param name="SenderName">Display sender name for the account.</param>
/// <param name="Base64ProfilePictureData">Base 64 encoded profile picture data of the account. Thumbnail size.</param>
public record ProfileInformation(string SenderName, string Base64ProfilePictureData);
}

View File

@@ -1,13 +0,0 @@
using System;
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Models.Accounts
{
public class UnreadItemCountResult
{
public Guid FolderId { get; set; }
public Guid AccountId { get; set; }
public SpecialFolderType SpecialFolderType { get; set; }
public int UnreadItemCount { get; set; }
}
}

View File

@@ -33,7 +33,7 @@ namespace Wino.Core.Domain.Models.Authorization
ClientId = clientId;
// Creates the OAuth 2.0 authorization request.
return string.Format("{0}?response_type=code&scope=https://mail.google.com/ https://www.googleapis.com/auth/gmail.labels https://www.googleapis.com/auth/userinfo.profile&redirect_uri={1}&client_id={2}&state={3}&code_challenge={4}&code_challenge_method={5}",
return string.Format("{0}?response_type=code&scope=https://mail.google.com/ https://www.googleapis.com/auth/gmail.labels&redirect_uri={1}&client_id={2}&state={3}&code_challenge={4}&code_challenge_method={5}",
authorizationEndpoint,
Uri.EscapeDataString(RedirectUri),
ClientId,

View File

@@ -0,0 +1,21 @@
using System;
namespace Wino.Core.Domain.Models.AutoDiscovery
{
public class AutoDiscoveryConnectionTestFailedPackage
{
public AutoDiscoveryConnectionTestFailedPackage(AutoDiscoverySettings settings, Exception error)
{
Settings = settings ?? throw new ArgumentNullException(nameof(settings));
Error = error ?? throw new ArgumentNullException(nameof(error));
}
public AutoDiscoveryConnectionTestFailedPackage(Exception error)
{
Error = error ?? throw new ArgumentNullException(nameof(error));
}
public AutoDiscoverySettings Settings { get; set; }
public Exception Error { get; set; }
}
}

View File

@@ -1,22 +1,22 @@
using System.Text.Json.Serialization;
using Newtonsoft.Json;
namespace Wino.Core.Domain.Models.AutoDiscovery
{
public class AutoDiscoveryProviderSetting
{
[JsonPropertyName("protocol")]
[JsonProperty("protocol")]
public string Protocol { get; set; }
[JsonPropertyName("address")]
[JsonProperty("address")]
public string Address { get; set; }
[JsonPropertyName("port")]
[JsonProperty("port")]
public int Port { get; set; }
[JsonPropertyName("secure")]
[JsonProperty("secure")]
public string Secure { get; set; }
[JsonPropertyName("username")]
[JsonProperty("username")]
public string Username { get; set; }
}
}

View File

@@ -1,19 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
using Newtonsoft.Json;
using Wino.Core.Domain.Entities;
namespace Wino.Core.Domain.Models.AutoDiscovery
{
public class AutoDiscoverySettings
{
[JsonPropertyName("domain")]
[JsonProperty("domain")]
public string Domain { get; set; }
[JsonPropertyName("password")]
[JsonProperty("password")]
public string Password { get; set; }
[JsonPropertyName("settings")]
[JsonProperty("settings")]
public List<AutoDiscoveryProviderSetting> Settings { get; set; }
/// <summary>
@@ -30,6 +30,9 @@ namespace Wino.Core.Domain.Models.AutoDiscovery
if (imapSettings == null || smtpSettings == null) return null;
bool imapRequiresSSL = imapSettings.Secure == "SSL";
bool smtpRequiresSSL = smtpSettings.Secure == "SSL";
string imapUrl = imapSettings.Address;
string smtpUrl = smtpSettings.Address;
@@ -46,18 +49,15 @@ namespace Wino.Core.Domain.Models.AutoDiscovery
Address = UserMinimalSettings.Email,
IncomingServerPassword = UserMinimalSettings.Password,
OutgoingServerPassword = UserMinimalSettings.Password,
IncomingAuthenticationMethod = Enums.ImapAuthenticationMethod.Auto,
OutgoingAuthenticationMethod = Enums.ImapAuthenticationMethod.Auto,
OutgoingServerSocketOption = Enums.ImapConnectionSecurity.Auto,
IncomingServerSocketOption = Enums.ImapConnectionSecurity.Auto,
IncomingRequiresSSL = imapRequiresSSL,
OutgoingRequresSSL = smtpRequiresSSL,
IncomingServer = imapUrl,
OutgoingServer = smtpUrl,
IncomingServerPort = imapPort.ToString(),
OutgoingServerPort = smtpPort.ToString(),
IncomingServerType = Enums.CustomIncomingServerType.IMAP4,
IncomingServerUsername = imapUsername,
OutgoingServerUsername = smtpUsername,
MaxConcurrentClients = 5
OutgoingServerUsername = smtpUsername
};
return serverInfo;

View File

@@ -1,12 +0,0 @@
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Models.Folders
{
/// <summary>
/// Encapsulates a request to prepare a folder operation like Rename, Delete, etc.
/// </summary>
/// <param name="Action">Folder operation.</param>
/// <param name="Folder">Target folder.</param>
public record FolderOperationPreperationRequest(FolderOperation Action, MailItemFolder Folder) { }
}

View File

@@ -1,76 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Wino.Core.Domain.Models.Launch;
public class MailToUri
{
public string Subject { get; private set; }
public string Body { get; private set; }
public List<string> To { get; } = [];
public List<string> Cc { get; } = [];
public List<string> Bcc { get; } = [];
public Dictionary<string, string> OtherParameters { get; } = [];
public MailToUri(string mailToUrl)
{
ParseMailToUrl(mailToUrl);
}
private void ParseMailToUrl(string mailToUrl)
{
if (string.IsNullOrWhiteSpace(mailToUrl))
throw new ArgumentException("mailtoUrl cannot be null or empty.", nameof(mailToUrl));
if (!mailToUrl.StartsWith("mailto:", StringComparison.OrdinalIgnoreCase))
throw new ArgumentException("URL must start with 'mailto:'.", nameof(mailToUrl));
var mailToWithoutScheme = mailToUrl.Substring(7); // Remove "mailto:"
var components = mailToWithoutScheme.Split('?');
if (!string.IsNullOrEmpty(components[0]))
{
To.AddRange(components[0].Split(',').Select(email => HttpUtility.UrlDecode(email).Trim()));
}
if (components.Length <= 1)
{
return;
}
var parameters = components[1].Split('&');
foreach (var parameter in parameters)
{
var keyValue = parameter.Split('=');
if (keyValue.Length != 2)
continue;
var key = keyValue[0].ToLowerInvariant();
var value = HttpUtility.UrlDecode(keyValue[1]);
switch (key)
{
case "to":
To.AddRange(value.Split(',').Select(email => email.Trim()));
break;
case "subject":
Subject = value;
break;
case "body":
Body = value;
break;
case "cc":
Cc.AddRange(value.Split(',').Select(email => email.Trim()));
break;
case "bcc":
Bcc.AddRange(value.Split(',').Select(email => email.Trim()));
break;
default:
OtherParameters[key] = value;
break;
}
}
}
}

View File

@@ -1,27 +1,40 @@
using MimeKit;
using System.Collections.Specialized;
using System.Linq;
using MimeKit;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Launch;
namespace Wino.Core.Domain.Models.MailItem;
public class DraftCreationOptions
namespace Wino.Core.Domain.Models.MailItem
{
public DraftCreationReason Reason { get; set; }
public class DraftCreationOptions
{
public MimeMessage ReferenceMimeMessage { get; set; }
public MailCopy ReferenceMailCopy { get; set; }
public DraftCreationReason Reason { get; set; }
/// <summary>
/// Used for forward/reply
/// </summary>
public ReferencedMessage ReferencedMessage { get; set; }
#region Mailto Protocol Related Stuff
/// <summary>
/// Used to create mails from Mailto links
/// </summary>
public MailToUri MailToUri { get; set; }
}
public class ReferencedMessage
{
public MailCopy MailCopy { get; set; }
public MimeMessage MimeMessage { get; set; }
public const string MailtoSubjectParameterKey = "subject";
public const string MailtoBodyParameterKey = "body";
public const string MailtoToParameterKey = "mailto";
public const string MailtoCCParameterKey = "cc";
public const string MailtoBCCParameterKey = "bcc";
public NameValueCollection MailtoParameters { get; set; }
private bool IsMailtoParameterExists(string parameterKey)
=> MailtoParameters != null
&& MailtoParameters.AllKeys.Contains(parameterKey);
public bool TryGetMailtoValue(string key, out string value)
{
bool valueExists = IsMailtoParameterExists(key);
value = valueExists ? MailtoParameters[key] : string.Empty;
return valueExists;
}
#endregion
}
}

View File

@@ -1,55 +0,0 @@
using System;
using System.Text.Json.Serialization;
using MimeKit;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Extensions;
namespace Wino.Core.Domain.Models.MailItem;
public class DraftPreparationRequest
{
public DraftPreparationRequest(MailAccount account,
MailCopy createdLocalDraftCopy,
string base64EncodedMimeMessage,
DraftCreationReason reason,
MailCopy referenceMailCopy = null)
{
Account = account ?? throw new ArgumentNullException(nameof(account));
CreatedLocalDraftCopy = createdLocalDraftCopy ?? throw new ArgumentNullException(nameof(createdLocalDraftCopy));
ReferenceMailCopy = referenceMailCopy;
// MimeMessage is not serializable with System.Text.Json. Convert to base64 string.
// This is additional work when deserialization needed, but not much to do atm.
Base64LocalDraftMimeMessage = base64EncodedMimeMessage;
Reason = reason;
}
[JsonConstructor]
private DraftPreparationRequest() { }
public MailCopy CreatedLocalDraftCopy { get; set; }
public MailCopy ReferenceMailCopy { get; set; }
public string Base64LocalDraftMimeMessage { get; set; }
public DraftCreationReason Reason { get; set; }
[JsonIgnore]
private MimeMessage createdLocalDraftMimeMessage;
[JsonIgnore]
public MimeMessage CreatedLocalDraftMimeMessage
{
get
{
createdLocalDraftMimeMessage ??= Base64LocalDraftMimeMessage.GetMimeMessageFromBase64();
return createdLocalDraftMimeMessage;
}
}
public MailAccount Account { get; set; }
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Text;
using MimeKit;
using Wino.Core.Domain.Entities;
namespace Wino.Core.Domain.Models.MailItem
{
public class DraftPreperationRequest : DraftCreationOptions
{
public DraftPreperationRequest(MailAccount account, MailCopy createdLocalDraftCopy, MimeMessage createdLocalDraftMimeMessage)
{
Account = account ?? throw new ArgumentNullException(nameof(account));
CreatedLocalDraftCopy = createdLocalDraftCopy ?? throw new ArgumentNullException(nameof(createdLocalDraftCopy));
CreatedLocalDraftMimeMessage = createdLocalDraftMimeMessage ?? throw new ArgumentNullException(nameof(createdLocalDraftMimeMessage));
}
public MailCopy CreatedLocalDraftCopy { get; set; }
public MimeMessage CreatedLocalDraftMimeMessage { get; set; }
public MailAccount Account { get; }
}
}

View File

@@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Wino.Core.Domain.Models.MailItem
{
/// <summary>
/// An interface that returns the UniqueId store for IMailItem.
/// For threads, it may be multiple items.
/// For single mails, it'll always be one item.
/// </summary>
public interface IMailHashContainer
{
IEnumerable<Guid> GetContainingIds();
}
}

View File

@@ -6,7 +6,7 @@ namespace Wino.Core.Domain.Models.MailItem
/// <summary>
/// Interface of simplest representation of a MailCopy.
/// </summary>
public interface IMailItem : IMailHashContainer
public interface IMailItem
{
Guid UniqueId { get; }
string Id { get; }
@@ -29,6 +29,5 @@ namespace Wino.Core.Domain.Models.MailItem
MailItemFolder AssignedFolder { get; }
MailAccount AssignedAccount { get; }
AccountContact SenderContact { get; }
}
}

View File

@@ -9,31 +9,61 @@ namespace Wino.Core.Domain.Models.MailItem
/// <summary>
/// Encapsulates the options for preparing requests to execute mail operations for mail items like Move, Delete, MarkAsRead, etc.
/// </summary>
/// <param name="Action"> Action to execute. </param>
/// <param name="MailItems"> Mail copies execute the action on. </param>
/// <param name="ToggleExecution"> Whether the operation can be reverted if needed.
/// eg. MarkAsRead on already read item will set the action to MarkAsUnread.
/// This is used in hover actions for example. </param>
/// <param name="IgnoreHardDeleteProtection"> Whether hard delete protection should be ignored.
/// Discard draft requests for example should ignore hard delete protection. </param>
/// <param name="MoveTargetFolder"> Moving folder for the Move operation.
/// If null and the action is Move, the user will be prompted to select a folder. </param>
public record MailOperationPreperationRequest(MailOperation Action, IEnumerable<MailCopy> MailItems, bool ToggleExecution, bool IgnoreHardDeleteProtection, IMailItemFolder MoveTargetFolder)
public class MailOperationPreperationRequest
{
public MailOperationPreperationRequest(MailOperation action,
IEnumerable<MailCopy> mailItems,
bool toggleExecution = false,
IMailItemFolder moveTargetFolder = null,
bool ignoreHardDeleteProtection = false) : this(action, mailItems ?? throw new ArgumentNullException(nameof(mailItems)), toggleExecution, ignoreHardDeleteProtection, moveTargetFolder)
bool ignoreHardDeleteProtection = false)
{
Action = action;
MailItems = mailItems ?? throw new ArgumentNullException(nameof(mailItems));
ToggleExecution = toggleExecution;
MoveTargetFolder = moveTargetFolder;
IgnoreHardDeleteProtection = ignoreHardDeleteProtection;
}
public MailOperationPreperationRequest(MailOperation action,
MailCopy singleMailItem,
bool toggleExecution = false,
IMailItemFolder moveTargetFolder = null,
bool ignoreHardDeleteProtection = false) : this(action, new List<MailCopy>() { singleMailItem }, toggleExecution, ignoreHardDeleteProtection, moveTargetFolder)
bool ignoreHardDeleteProtection = false)
{
Action = action;
MailItems = new List<MailCopy>() { singleMailItem };
ToggleExecution = toggleExecution;
MoveTargetFolder = moveTargetFolder;
IgnoreHardDeleteProtection = ignoreHardDeleteProtection;
}
/// <summary>
/// Action to execute.
/// </summary>
public MailOperation Action { get; set; }
/// <summary>
/// Mail copies execute the action on.
/// </summary>
public IEnumerable<MailCopy> MailItems { get; set; }
/// <summary>
/// Whether the operation can be reverted if needed.
/// eg. MarkAsRead on already read item will set the action to MarkAsUnread.
/// This is used in hover actions for example.
/// </summary>
public bool ToggleExecution { get; set; }
/// <summary>
/// Whether hard delete protection should be ignored.
/// Discard draft requests for example should ignore hard delete protection.
/// </summary>
public bool IgnoreHardDeleteProtection { get; set; }
/// <summary>
/// Moving folder for the Move operation.
/// If null and the action is Move, the user will be prompted to select a folder.
/// </summary>
public IMailItemFolder MoveTargetFolder { get; }
}
}

View File

@@ -1,21 +1,7 @@
using System.Text.Json.Serialization;
using MimeKit;
using MimeKit;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Extensions;
namespace Wino.Core.Domain.Models.MailItem
{
public record SendDraftPreparationRequest(MailCopy MailItem,
MailAccountAlias SendingAlias,
MailItemFolder SentFolder,
MailItemFolder DraftFolder,
MailAccountPreferences AccountPreferences,
string Base64MimeMessage)
{
[JsonIgnore]
private MimeMessage mime;
[JsonIgnore]
public MimeMessage Mime => mime ??= Base64MimeMessage.GetMimeMessageFromBase64();
}
public record SendDraftPreparationRequest(MailCopy MailItem, MimeMessage Mime, MailItemFolder DraftFolder, MailItemFolder SentFolder, MailAccountPreferences AccountPreferences);
}

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Wino.Core.Domain.Entities;
@@ -41,8 +40,6 @@ namespace Wino.Core.Domain.Models.MailItem
}
}
public IEnumerable<Guid> GetContainingIds() => ThreadItems?.Select(a => a.UniqueId) ?? default;
#region IMailItem
public Guid UniqueId => LatestMailItem?.UniqueId ?? Guid.Empty;
@@ -85,8 +82,6 @@ namespace Wino.Core.Domain.Models.MailItem
public Guid FileId => LatestMailItem?.FileId ?? Guid.Empty;
public AccountContact SenderContact => LatestMailItem?.SenderContact;
#endregion
}
}

View File

@@ -3,6 +3,6 @@
public enum NavigationTransitionType
{
None, // Supress
DrillIn
DrillIn,
}
}

View File

@@ -0,0 +1,4 @@
namespace Wino.Core.Domain.Models.Personalization
{
public record MailListPaneLengthPreferences(string Title, double Length);
}

View File

@@ -0,0 +1,30 @@
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Models.Reader
{
public class EditorToolbarSection
{
public EditorToolbarSectionType SectionType { get; set; }
public string Title
{
get
{
switch (SectionType)
{
case EditorToolbarSectionType.None:
return Translator.EditorToolbarOption_None;
case EditorToolbarSectionType.Format:
return Translator.EditorToolbarOption_Format;
case EditorToolbarSectionType.Insert:
return Translator.EditorToolbarOption_Insert;
case EditorToolbarSectionType.Draw:
return Translator.EditorToolbarOption_Draw;
case EditorToolbarSectionType.Options:
return Translator.EditorToolbarOption_Options;
default:
return "Unknown Editor Option";
}
}
}
}
}

View File

@@ -1,12 +0,0 @@
using System.Text.Json.Serialization;
namespace Wino.Core.Domain.Models.Reader;
public class ImageInfo
{
[JsonPropertyName("data")]
public string Data { get; set; }
[JsonPropertyName("name")]
public string Name { get; set; }
}

View File

@@ -11,9 +11,10 @@ namespace Wino.Core.Domain.Models.Reader
{
public string RenderHtml { get; }
public MailRenderingOptions MailRenderingOptions { get; }
public List<MimePart> Attachments { get; set; } = [];
public List<MimePart> Attachments { get; set; } = new List<MimePart>();
public UnsubscribeInfo UnsubscribeInfo { get; set; }
public string UnsubscribeLink { get; set; }
public bool CanUnsubscribe => !string.IsNullOrEmpty(UnsubscribeLink);
public MailRenderModel(string renderHtml, MailRenderingOptions mailRenderingOptions = null)
{
@@ -21,12 +22,4 @@ namespace Wino.Core.Domain.Models.Reader
MailRenderingOptions = mailRenderingOptions;
}
}
public class UnsubscribeInfo
{
public string HttpLink { get; set; }
public string MailToLink { get; set; }
public bool IsOneClick { get; set; }
public bool CanUnsubscribe => HttpLink != null || MailToLink != null;
}
}

View File

@@ -0,0 +1,6 @@
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Models.Reader
{
public record ReaderFontModel(ReaderFont Font, string FontFamilyName);
}

View File

@@ -1,16 +0,0 @@
using System.Text.Json.Serialization;
namespace Wino.Core.Domain.Models.Reader
{
/// <summary>
/// Used to pass messages from the webview to the app.
/// </summary>
public class WebViewMessage
{
[JsonPropertyName("type")]
public string Type { get; set; }
[JsonPropertyName("value")]
public string Value { get; set; }
}
}

View File

@@ -1,4 +1,4 @@
namespace Wino.Core.Domain.Interfaces
namespace Wino.Core.Domain.Models.Requests
{
/// <summary>
/// Interface for all messages to report UI changes from synchronizers to UI.
@@ -6,6 +6,5 @@
/// They are sent either from processor or view models to signal some other
/// parts of the application.
/// </summary>
public interface IUIMessage;
}

View File

@@ -11,24 +11,17 @@ namespace Wino.Core.Domain.Models.Requests
public abstract IBatchChangeRequest CreateBatch(IEnumerable<IRequest> requests);
public abstract void ApplyUIChanges();
public abstract void RevertUIChanges();
public virtual int ResynchronizationDelay => 0;
}
public abstract record FolderRequestBase(MailItemFolder Folder, MailSynchronizerOperation Operation) : IFolderRequest
{
public abstract void ApplyUIChanges();
public abstract void RevertUIChanges();
public virtual int ResynchronizationDelay => 0;
}
public abstract record BatchRequestBase(IEnumerable<IRequest> Items, MailSynchronizerOperation Operation) : IBatchChangeRequest
{
public abstract void ApplyUIChanges();
public abstract void RevertUIChanges();
public virtual int ResynchronizationDelay => 0;
public virtual bool ExecuteSerialBatch => false;
}
}

View File

@@ -1,15 +0,0 @@
using System;
using Wino.Core.Domain.Interfaces;
namespace Wino.Core.Domain.Models.Requests
{
/// <summary>
/// Encapsulates request to queue and account for synchronizer.
/// </summary>
/// <param name="AccountId">Which account to execute this request for.</param>
/// <param name="Request">Prepared request for the server.</param>
public record ServerRequestPackage(Guid AccountId, IRequestBase Request) : IClientMessage
{
public override string ToString() => $"Server Package: {Request.GetType().Name}";
}
}

View File

@@ -1,7 +1,8 @@
using System;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.MailItem;
namespace Wino.Core.Domain.Models.MailItem
namespace Wino.Core.Domain.Models.Requests
{
/// <summary>
/// Defines a single rule for toggling user actions if needed.

View File

@@ -1,40 +0,0 @@
using Wino.Core.Domain.Exceptions;
namespace Wino.Core.Domain.Models.Server
{
/// <summary>
/// Encapsulates responses from the Wino server.
/// Exceptions are stored separately in the Message and StackTrace properties due to serialization issues.
/// </summary>
/// <typeparam name="T">Type of the expected response.</typeparam>
public class WinoServerResponse<T>
{
public bool IsSuccess { get; set; }
public string Message { get; set; }
public T Data { get; set; }
public static WinoServerResponse<T> CreateSuccessResponse(T data)
{
return new WinoServerResponse<T>
{
IsSuccess = true,
Data = data
};
}
public static WinoServerResponse<T> CreateErrorResponse(string message)
{
return new WinoServerResponse<T>
{
IsSuccess = false,
Message = message
};
}
public void ThrowIfFailed()
{
if (!IsSuccess)
throw new WinoServerException(Message);
}
}
}

Some files were not shown because too many files have changed in this diff Show More