Merge branch 'main' into hotfix/Expander

This commit is contained in:
Burak Kaan Köse
2024-08-30 01:11:19 +02:00
36 changed files with 430 additions and 560 deletions

View File

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

View File

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

View File

@@ -9,7 +9,6 @@ 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();

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Models.Folders;
using Wino.Core.Domain.Models.MailItem;
namespace Wino.Core.Domain.Interfaces
@@ -12,7 +13,7 @@ namespace Wino.Core.Domain.Interfaces
/// </summary>
/// <param name="items">Original mails.</param>
/// <returns>Original mails with thread mails.</returns>
Task<List<IMailItem>> ThreadItemsAsync(List<MailCopy> items);
Task<List<IMailItem>> ThreadItemsAsync(List<MailCopy> items, IMailItemFolder threadingForFolder);
bool ShouldThreadWithItem(IMailItem originalItem, IMailItem targetItem);
}
}

View File

@@ -14,19 +14,19 @@ namespace Wino.Core.Domain.Models.MailItem
public IMailItem LatestMailItem => ThreadItems.LastOrDefault();
public IMailItem FirstMailItem => ThreadItems.FirstOrDefault();
public void AddThreadItem(IMailItem item)
public bool AddThreadItem(IMailItem item)
{
if (item == null) return;
if (item == null) return false;
if (ThreadItems.Any(a => a.Id == item.Id))
{
return;
return false;
}
if (item != null && item.IsDraft)
{
ThreadItems.Insert(0, item);
return;
return true;
}
var insertItem = ThreadItems.FirstOrDefault(a => !a.IsDraft && a.CreationDate < item.CreationDate);
@@ -39,6 +39,8 @@ namespace Wino.Core.Domain.Models.MailItem
ThreadItems.Insert(index, item);
}
return true;
}
public IEnumerable<Guid> GetContainingIds() => ThreadItems?.Select(a => a.UniqueId) ?? default;

View File

@@ -1,30 +0,0 @@
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

@@ -53,6 +53,7 @@
"Buttons_TryAgain": "Try Again",
"Buttons_Yes": "Yes",
"Buttons_Reset": "Reset",
"Buttons_Send": "Send",
"Center": "Center",
"ComingSoon": "Coming soon...",
"ComposerFrom": "From: ",

View File

@@ -288,6 +288,11 @@ namespace Wino.Core.Domain
/// </summary>
public static string Buttons_Reset => Resources.GetTranslatedString(@"Buttons_Reset");
/// <summary>
/// Send
/// </summary>
public static string Buttons_Send => Resources.GetTranslatedString(@"Buttons_Send");
/// <summary>
/// Center
/// </summary>

View File

@@ -62,7 +62,7 @@
</PackageReference>
<PackageReference Include="MimeKit" Version="4.7.1" />
<PackageReference Include="MailKit" Version="4.7.1.1" />
<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>
<ItemGroup>

View File

@@ -46,7 +46,6 @@ namespace Wino.Services
public event EventHandler<ApplicationElementTheme> ElementThemeChanged;
public event EventHandler<string> AccentColorChanged;
public event EventHandler<string> AccentColorChangedBySystem;
private const string AccentColorKey = nameof(AccentColorKey);
private const string CurrentApplicationThemeKey = nameof(CurrentApplicationThemeKey);

View File

@@ -112,7 +112,7 @@
<Version>7.1.2</Version>
</PackageReference>
<PackageReference Include="Microsoft.AppCenter.Analytics">
<Version>5.0.4</Version>
<Version>5.0.5</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.14</Version>

View File

@@ -26,8 +26,6 @@ namespace Wino.Core.Authenticators
private readonly INativeAppService _nativeAppService;
public event EventHandler<string> InteractiveAuthenticationRequired;
public GmailAuthenticator(ITokenService tokenService, INativeAppService nativeAppService) : base(tokenService)
{
_nativeAppService = nativeAppService;

View File

@@ -28,7 +28,16 @@ namespace Wino.Core.Authenticators
public string ClientId { get; } = "b19c2035-d740-49ff-b297-de6ec561b208";
private readonly string[] MailScope = ["email", "mail.readwrite", "offline_access", "mail.send", "Mail.Send.Shared", "Mail.ReadWrite.Shared"];
private readonly string[] MailScope =
[
"email",
"mail.readwrite",
"offline_access",
"mail.send",
"Mail.Send.Shared",
"Mail.ReadWrite.Shared",
"User.Read"
];
public override MailProviderType ProviderType => MailProviderType.Outlook;

View File

@@ -180,7 +180,7 @@ namespace Wino.Core.Extensions
// Some headers also require to start with X- or x-.
string[] headersToIgnore = ["Date", "To", "MIME-Version", "From", "Subject", "Message-Id"];
string[] headersToIgnore = ["Date", "To", "Cc", "Bcc", "MIME-Version", "From", "Subject", "Message-Id"];
string[] headersToModify = ["In-Reply-To", "Reply-To", "References", "Thread-Topic"];
var headers = new List<InternetMessageHeader>();
@@ -191,15 +191,12 @@ namespace Wino.Core.Extensions
{
if (!headersToIgnore.Contains(header.Field))
{
if (headersToModify.Contains(header.Field))
{
headers.Add(new InternetMessageHeader() { Name = $"X-{header.Field}", Value = header.Value });
}
else
{
headers.Add(new InternetMessageHeader() { Name = header.Field, Value = header.Value });
}
var headerName = headersToModify.Contains(header.Field) ? $"X-{header.Field}" : header.Field;
// No header value should exceed 995 characters.
var headerValue = header.Value.Length >= 995 ? header.Value.Substring(0, 995) : header.Value;
headers.Add(new InternetMessageHeader() { Name = headerName, Value = headerValue });
includedHeaderCount++;
}

View File

@@ -21,7 +21,6 @@ namespace Wino.Core.Integration.Processors
{
Task UpdateAccountAsync(MailAccount account);
Task<string> UpdateAccountDeltaSynchronizationIdentifierAsync(Guid accountId, string deltaSynchronizationIdentifier);
Task CreateAssignmentAsync(Guid accountId, string mailCopyId, string remoteFolderId);
Task DeleteAssignmentAsync(Guid accountId, string mailCopyId, string remoteFolderId);
Task ChangeMailReadStatusAsync(string mailCopyId, bool isRead);
Task ChangeFlagStatusAsync(string mailCopyId, bool isFlagged);
@@ -53,6 +52,7 @@ namespace Wino.Core.Integration.Processors
public interface IGmailChangeProcessor : IDefaultChangeProcessor
{
Task MapLocalDraftAsync(string mailCopyId, string newDraftId, string newThreadId);
Task CreateAssignmentAsync(Guid accountId, string mailCopyId, string remoteFolderId);
}
public interface IOutlookChangeProcessor : IDefaultChangeProcessor
@@ -135,8 +135,7 @@ namespace Wino.Core.Integration.Processors
public Task DeleteAssignmentAsync(Guid accountId, string mailCopyId, string remoteFolderId)
=> MailService.DeleteAssignmentAsync(accountId, mailCopyId, remoteFolderId);
public Task CreateAssignmentAsync(Guid accountId, string mailCopyId, string remoteFolderId)
=> MailService.CreateAssignmentAsync(accountId, mailCopyId, remoteFolderId);
public Task DeleteMailAsync(Guid accountId, string mailId)
=> MailService.DeleteMailAsync(accountId, mailId);

View File

@@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Services;
@@ -12,5 +13,8 @@ namespace Wino.Core.Integration.Processors
public Task MapLocalDraftAsync(string mailCopyId, string newDraftId, string newThreadId)
=> MailService.MapLocalDraftAsync(mailCopyId, newDraftId, newThreadId);
public Task CreateAssignmentAsync(Guid accountId, string mailCopyId, string remoteFolderId)
=> MailService.CreateAssignmentAsync(accountId, mailCopyId, remoteFolderId);
}
}

View File

@@ -5,6 +5,7 @@ using System.Threading.Tasks;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.Folders;
using Wino.Core.Domain.Models.MailItem;
using Wino.Core.Services;
@@ -27,7 +28,7 @@ namespace Wino.Core.Integration.Threading
}
///<inheritdoc/>
public async Task<List<IMailItem>> ThreadItemsAsync(List<MailCopy> items)
public async Task<List<IMailItem>> ThreadItemsAsync(List<MailCopy> items, IMailItemFolder threadingForFolder)
{
var assignedAccount = items[0].AssignedAccount;
@@ -62,11 +63,43 @@ namespace Wino.Core.Integration.Threading
}
var thread = new ThreadMailItem();
foreach (var childThreadItem in threadItem)
{
thread.AddThreadItem(childThreadItem);
if (thread.ThreadItems.Any(a => a.Id == childThreadItem.Id))
{
// Mail already exist in the thread.
// There should be only 1 instance of the mail in the thread.
// Make sure we add the correct one.
// Add the one with threading folder.
var threadingFolderItem = threadItem.FirstOrDefault(a => a.Id == childThreadItem.Id && a.FolderId == threadingForFolder.Id);
if (threadingFolderItem == null) continue;
// Remove the existing one.
thread.ThreadItems.Remove(thread.ThreadItems.First(a => a.Id == childThreadItem.Id));
// Add the correct one for listing.
thread.AddThreadItem(threadingFolderItem);
}
else
{
thread.AddThreadItem(childThreadItem);
}
}
if (thread.ThreadItems.Count > 1)
{
resultList.Add(thread);
}
else
{
// Don't make threads if the thread has only one item.
// Gmail has may have multiple assignments for the same item.
resultList.Add(thread.ThreadItems.First());
}
resultList.Add(thread);
}
}

View File

@@ -5,6 +5,7 @@ using System.Threading.Tasks;
using SqlKata;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.Folders;
using Wino.Core.Domain.Models.MailItem;
using Wino.Core.Extensions;
using Wino.Core.Services;
@@ -58,7 +59,7 @@ namespace Wino.Core.Integration.Threading
return _databaseService.Connection.FindWithQueryAsync<MailCopy>(query.GetRawQuery());
}
public async Task<List<IMailItem>> ThreadItemsAsync(List<MailCopy> items)
public async Task<List<IMailItem>> ThreadItemsAsync(List<MailCopy> items, IMailItemFolder threadingForFolder)
{
var threads = new List<ThreadMailItem>();

View File

@@ -58,7 +58,7 @@ namespace Wino.Core.Requests
Items.ForEach(item => WeakReferenceMessenger.Default.Send(new MailAddedMessage(item.Item)));
}
public override int ResynchronizationDelay => 10000;
public override int ResynchronizationDelay => 6000;
public override bool ExecuteSerialBatch => true;
}
}

View File

@@ -241,7 +241,7 @@ namespace Wino.Core.Services
// Only thread items from Draft and Sent folders must present here.
// Otherwise this strategy will fetch the items that are in Deleted folder as well.
var accountThreadedItems = await threadingStrategy.ThreadItemsAsync([.. group]);
var accountThreadedItems = await threadingStrategy.ThreadItemsAsync([.. group], options.Folders.First());
// Populate threaded items with folder and account assignments.
// Almost everything already should be in cache from initial population.
@@ -409,12 +409,11 @@ namespace Wino.Core.Services
foreach (var mailItem in allMails)
{
await DeleteMailInternalAsync(mailItem).ConfigureAwait(false);
// Delete mime file.
// Delete mime file as well.
// Even though Gmail might have multiple copies for the same mail, we only have one MIME file for all.
// Their FileId is inserted same.
await _mimeFileService.DeleteMimeMessageAsync(accountId, mailItem.FileId);
await DeleteMailInternalAsync(mailItem, preserveMimeFile: false).ConfigureAwait(false);
}
}
@@ -457,7 +456,7 @@ namespace Wino.Core.Services
ReportUIChange(new MailUpdatedMessage(mailCopy));
}
private async Task DeleteMailInternalAsync(MailCopy mailCopy)
private async Task DeleteMailInternalAsync(MailCopy mailCopy, bool preserveMimeFile)
{
if (mailCopy == null)
{
@@ -473,7 +472,7 @@ namespace Wino.Core.Services
// If there are no more copies exists of the same mail, delete the MIME file as well.
var isMailExists = await IsMailExistsAsync(mailCopy.Id).ConfigureAwait(false);
if (!isMailExists)
if (!isMailExists && !preserveMimeFile)
{
await _mimeFileService.DeleteMimeMessageAsync(mailCopy.AssignedAccount.Id, mailCopy.FileId).ConfigureAwait(false);
}
@@ -554,6 +553,19 @@ namespace Wino.Core.Services
return;
}
if (mailCopy.AssignedFolder.SpecialFolderType == SpecialFolderType.Sent &&
localFolder.SpecialFolderType == SpecialFolderType.Deleted)
{
// Sent item is deleted.
// Gmail does not delete the sent items, but moves them to the deleted folder.
// API doesn't allow removing Sent label.
// Here we intercept this behavior, removing the Sent copy of the mail and adding the Deleted copy.
// This way item will only be visible in Trash folder as in Gmail Web UI.
// Don't delete MIME file since if exists.
await DeleteMailInternalAsync(mailCopy, preserveMimeFile: true).ConfigureAwait(false);
}
// Copy one of the mail copy and assign it to the new folder.
// We don't need to create a new MIME pack.
// Therefore FileId is not changed for the new MailCopy.
@@ -585,7 +597,7 @@ namespace Wino.Core.Services
return;
}
await DeleteMailInternalAsync(mailItem).ConfigureAwait(false);
await DeleteMailInternalAsync(mailItem, preserveMimeFile: false).ConfigureAwait(false);
}
public async Task<bool> CreateMailAsync(Guid accountId, NewMailItemPackage package)

View File

@@ -595,13 +595,23 @@ namespace Wino.Core.Synchronizers
{
return CreateBatchedHttpBundleFromGroup(request, (items) =>
{
// Sent label can't be removed from mails for Gmail.
// They are automatically assigned by Gmail.
// When you delete sent mail from gmail web portal, it's moved to Trash
// but still has Sent label. It's just hidden from the user.
// Proper assignments will be done later on CreateAssignment call to mimic this behavior.
var batchModifyRequest = new BatchModifyMessagesRequest
{
Ids = items.Select(a => a.Item.Id.ToString()).ToList(),
AddLabelIds = new[] { request.ToFolder.RemoteFolderId },
RemoveLabelIds = new[] { request.FromFolder.RemoteFolderId }
AddLabelIds = [request.ToFolder.RemoteFolderId]
};
// Only add remove label ids if the source folder is not sent folder.
if (request.FromFolder.SpecialFolderType != SpecialFolderType.Sent)
{
batchModifyRequest.RemoveLabelIds = [request.FromFolder.RemoteFolderId];
}
return _gmailService.Users.Messages.BatchModify(batchModifyRequest, "me");
});
}
@@ -793,6 +803,8 @@ namespace Wino.Core.Synchronizers
var bundleRequestCount = bundle.Count();
var bundleTasks = new List<Task>();
for (int k = 0; k < bundleRequestCount; k++)
{
var requestBundle = bundle.ElementAt(k);
@@ -802,37 +814,40 @@ namespace Wino.Core.Synchronizers
request.ApplyUIChanges();
// TODO: Queue is synchronous. Create a task bucket to await all processing.
nativeBatchRequest.Queue<object>(nativeRequest, async (content, error, index, message)
=> await ProcessSingleNativeRequestResponseAsync(requestBundle, error, message, cancellationToken).ConfigureAwait(false));
nativeBatchRequest.Queue<object>(nativeRequest, (content, error, index, message)
=> bundleTasks.Add(ProcessSingleNativeRequestResponseAsync(requestBundle, error, message, cancellationToken)));
}
await nativeBatchRequest.ExecuteAsync(cancellationToken).ConfigureAwait(false);
await Task.WhenAll(bundleTasks);
}
}
private void ProcessGmailRequestError(RequestError error)
private void ProcessGmailRequestError(RequestError error, IRequestBundle<IClientServiceRequest> bundle)
{
if (error == null) return;
// OutOfMemoryException is a known bug in Gmail SDK.
if (error.Code == 0)
{
bundle?.Request.RevertUIChanges();
throw new OutOfMemoryException(error.Message);
}
// Entity not found.
if (error.Code == 404)
{
bundle?.Request.RevertUIChanges();
throw new SynchronizerEntityNotFoundException(error.Message);
}
if (!string.IsNullOrEmpty(error.Message))
{
bundle?.Request.RevertUIChanges();
error.Errors?.ForEach(error => _logger.Error("Unknown Gmail SDK error for {Name}\n{Error}", Account.Name, error));
// TODO: Debug
// throw new SynchronizerException(error.Message);
throw new SynchronizerException(error.Message);
}
}
@@ -851,7 +866,7 @@ namespace Wino.Core.Synchronizers
{
try
{
ProcessGmailRequestError(error);
ProcessGmailRequestError(error, null);
}
catch (OutOfMemoryException)
{
@@ -900,7 +915,7 @@ namespace Wino.Core.Synchronizers
HttpResponseMessage httpResponseMessage,
CancellationToken cancellationToken = default)
{
ProcessGmailRequestError(error);
ProcessGmailRequestError(error, bundle);
if (bundle is HttpRequestBundle<IClientServiceRequest, Message> messageBundle)
{

View File

@@ -12,6 +12,7 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.Graph;
using Microsoft.Graph.Models;
using Microsoft.Graph.Models.ODataErrors;
using Microsoft.Kiota.Abstractions;
using Microsoft.Kiota.Abstractions.Authentication;
using Microsoft.Kiota.Http.HttpClientLibrary.Middleware;
@@ -473,13 +474,27 @@ namespace Wino.Core.Synchronizers
/// <returns>Base64 encoded profile picture.</returns>
private async Task<string> GetUserProfilePictureAsync()
{
var photoStream = await _graphClient.Me.Photos["48x48"].Content.GetAsync();
try
{
var photoStream = await _graphClient.Me.Photos["48x48"].Content.GetAsync();
using var memoryStream = new MemoryStream();
await photoStream.CopyToAsync(memoryStream);
var byteArray = memoryStream.ToArray();
using var memoryStream = new MemoryStream();
await photoStream.CopyToAsync(memoryStream);
var byteArray = memoryStream.ToArray();
return Convert.ToBase64String(byteArray);
return Convert.ToBase64String(byteArray);
}
catch (ODataError odataError) when (odataError.Error.Code == "ImageNotFound")
{
// Accounts without profile picture will throw this error.
// At this point nothing we can do. Just return empty string.
return string.Empty;
}
catch (Exception)
{
throw;
}
}
/// <summary>

View File

@@ -18,7 +18,7 @@
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="Google.Apis.Gmail.v1" Version="1.68.0.3427" />
<PackageReference Include="Google.Apis.PeopleService.v1" Version="1.68.0.3359" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.63" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.64" />
<PackageReference Include="HtmlKit" Version="1.1.0" />
<PackageReference Include="IsExternalInit" Version="1.0.3">
<PrivateAssets>all</PrivateAssets>
@@ -27,16 +27,16 @@
<PackageReference Include="MailKit" Version="4.7.1.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Graph" Version="5.56.0" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.63.0" />
<PackageReference Include="Microsoft.Identity.Client.Broker" Version="4.63.0" />
<PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="4.63.0" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.64.0" />
<PackageReference Include="Microsoft.Identity.Client.Broker" Version="4.64.0" />
<PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="4.64.0" />
<PackageReference Include="MimeKit" Version="4.7.1" />
<PackageReference Include="morelinq" Version="4.1.0" />
<PackageReference Include="morelinq" Version="4.3.0" />
<PackageReference Include="Nito.AsyncEx.Tasks" Version="5.1.2" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog" Version="4.0.1" />
<PackageReference Include="Serilog.Exceptions" Version="8.4.0" />
<PackageReference Include="Serilog.Sinks.Debug" Version="2.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Debug" Version="3.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageReference Include="SkiaSharp" Version="2.88.8" />
<PackageReference Include="SqlKata" Version="2.4.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" />

View File

@@ -15,7 +15,6 @@ using Wino.Core.Domain.Exceptions;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.MailItem;
using Wino.Core.Domain.Models.Navigation;
using Wino.Core.Domain.Models.Reader;
using Wino.Core.Extensions;
using Wino.Core.Services;
using Wino.Mail.ViewModels.Data;
@@ -89,29 +88,11 @@ namespace Wino.Mail.ViewModels
public ObservableCollection<AccountContact> CCItems { get; set; } = [];
public ObservableCollection<AccountContact> BCCItems { get; set; } = [];
public List<EditorToolbarSection> ToolbarSections { get; set; } =
[
new EditorToolbarSection(){ SectionType = EditorToolbarSectionType.Format },
new EditorToolbarSection(){ SectionType = EditorToolbarSectionType.Insert },
new EditorToolbarSection(){ SectionType = EditorToolbarSectionType.Draw },
new EditorToolbarSection(){ SectionType = EditorToolbarSectionType.Options }
];
private EditorToolbarSection selectedToolbarSection;
public EditorToolbarSection SelectedToolbarSection
{
get => selectedToolbarSection;
set => SetProperty(ref selectedToolbarSection, value);
}
#endregion
public INativeAppService NativeAppService { get; }
private readonly IMailService _mailService;
private readonly ILaunchProtocolService _launchProtocolService;
private readonly IMimeFileService _mimeFileService;
private readonly IFolderService _folderService;
private readonly IAccountService _accountService;
@@ -123,7 +104,6 @@ namespace Wino.Mail.ViewModels
public ComposePageViewModel(IDialogService dialogService,
IMailService mailService,
ILaunchProtocolService launchProtocolService,
IMimeFileService mimeFileService,
INativeAppService nativeAppService,
IFolderService folderService,
@@ -141,13 +121,10 @@ namespace Wino.Mail.ViewModels
_folderService = folderService;
_mailService = mailService;
_launchProtocolService = launchProtocolService;
_mimeFileService = mimeFileService;
_accountService = accountService;
_worker = worker;
_winoServerConnectionManager = winoServerConnectionManager;
SelectedToolbarSection = ToolbarSections[0];
}
[RelayCommand]
@@ -263,31 +240,6 @@ namespace Wino.Mail.ViewModels
}
}
private void ClearCurrentMimeAttachments()
{
var attachments = new List<MimePart>();
var multiparts = new List<Multipart>();
var iter = new MimeIterator(CurrentMimeMessage);
// collect our list of attachments and their parent multiparts
while (iter.MoveNext())
{
var multipart = iter.Parent as Multipart;
var part = iter.Current as MimePart;
if (multipart != null && part != null && part.IsAttachment)
{
// keep track of each attachment's parent multipart
multiparts.Add(multipart);
attachments.Add(part);
}
}
// now remove each attachment from its parent multipart...
for (int i = 0; i < attachments.Count; i++)
multiparts[i].Remove(attachments[i]);
}
private async Task SaveBodyAsync()
{
if (GetHTMLBodyFunction != null)

View File

@@ -221,21 +221,9 @@ namespace Wino.Mail.ViewModels
_themeService.AccentColorChanged -= AccentColorChanged;
_themeService.ElementThemeChanged -= ElementThemeChanged;
_themeService.AccentColorChangedBySystem -= AccentColorChangedBySystem;
_themeService.AccentColorChanged += AccentColorChanged;
_themeService.ElementThemeChanged += ElementThemeChanged;
_themeService.AccentColorChangedBySystem += AccentColorChangedBySystem;
}
private void AccentColorChangedBySystem(object sender, string newAccentColorHex)
{
var accentInList = Colors.FirstOrDefault(a => a.IsAccentColor);
if (accentInList != null)
{
accentInList.Hex = newAccentColorHex;
}
}
private void AccentColorChanged(object sender, string e)
@@ -269,7 +257,6 @@ namespace Wino.Mail.ViewModels
_themeService.AccentColorChanged -= AccentColorChanged;
_themeService.ElementThemeChanged -= ElementThemeChanged;
_themeService.AccentColorChangedBySystem -= AccentColorChangedBySystem;
if (AppThemes != null)
{

View File

@@ -12,8 +12,8 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="5.0.4" />
<PackageReference Include="System.Reactive" Version="6.0.0" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="5.0.5" />
<PackageReference Include="System.Reactive" Version="6.0.1" />
</ItemGroup>
<ItemGroup>

View File

@@ -12,7 +12,6 @@ using Wino.Controls;
using Wino.Core.Domain;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.MailItem;
using Wino.Core.Domain.Models.Reader;
namespace Wino.Helpers
{
@@ -284,109 +283,60 @@ namespace Wino.Helpers
#endregion
#region Toolbar Section Initialization
public static Visibility IsFormatSection(EditorToolbarSection section) => section?.SectionType == EditorToolbarSectionType.Format ? Visibility.Visible : Visibility.Collapsed;
public static Visibility IsInsertSection(EditorToolbarSection section) => section?.SectionType == EditorToolbarSectionType.Insert ? Visibility.Visible : Visibility.Collapsed;
public static Visibility IsDrawSection(EditorToolbarSection section) => section?.SectionType == EditorToolbarSectionType.Draw ? Visibility.Visible : Visibility.Collapsed;
public static Visibility IsOptionsSection(EditorToolbarSection section) => section?.SectionType == EditorToolbarSectionType.Options ? Visibility.Visible : Visibility.Collapsed;
#endregion
#region Internationalization
public static string GetOperationString(MailOperation operation)
{
switch (operation)
return operation switch
{
case MailOperation.None:
return "unknown";
case MailOperation.Archive:
return Translator.MailOperation_Archive;
case MailOperation.UnArchive:
return Translator.MailOperation_Unarchive;
case MailOperation.SoftDelete:
return Translator.MailOperation_Delete;
case MailOperation.HardDelete:
return Translator.MailOperation_Delete;
case MailOperation.Move:
return Translator.MailOperation_Move;
case MailOperation.MoveToJunk:
return Translator.MailOperation_MoveJunk;
case MailOperation.MoveToFocused:
return Translator.MailOperation_MoveFocused;
case MailOperation.MoveToOther:
return Translator.MailOperation_MoveOther;
case MailOperation.AlwaysMoveToOther:
return Translator.MailOperation_AlwaysMoveOther;
case MailOperation.AlwaysMoveToFocused:
return Translator.MailOperation_AlwaysMoveFocused;
case MailOperation.SetFlag:
return Translator.MailOperation_SetFlag;
case MailOperation.ClearFlag:
return Translator.MailOperation_ClearFlag;
case MailOperation.MarkAsRead:
return Translator.MailOperation_MarkAsRead;
case MailOperation.MarkAsUnread:
return Translator.MailOperation_MarkAsUnread;
case MailOperation.MarkAsNotJunk:
return Translator.MailOperation_MarkNotJunk;
case MailOperation.Seperator:
return string.Empty;
case MailOperation.Ignore:
return Translator.MailOperation_Ignore;
case MailOperation.Reply:
return Translator.MailOperation_Reply;
case MailOperation.ReplyAll:
return Translator.MailOperation_ReplyAll;
case MailOperation.Zoom:
return Translator.MailOperation_Zoom;
case MailOperation.SaveAs:
return Translator.MailOperation_SaveAs;
case MailOperation.Find:
return Translator.MailOperation_Find;
case MailOperation.Forward:
return Translator.MailOperation_Forward;
case MailOperation.DarkEditor:
return string.Empty;
case MailOperation.LightEditor:
return string.Empty;
case MailOperation.Print:
return Translator.MailOperation_Print;
case MailOperation.Navigate:
return Translator.MailOperation_Navigate;
default:
return "unknown";
}
MailOperation.None => "unknown",
MailOperation.Archive => Translator.MailOperation_Archive,
MailOperation.UnArchive => Translator.MailOperation_Unarchive,
MailOperation.SoftDelete => Translator.MailOperation_Delete,
MailOperation.HardDelete => Translator.MailOperation_Delete,
MailOperation.Move => Translator.MailOperation_Move,
MailOperation.MoveToJunk => Translator.MailOperation_MoveJunk,
MailOperation.MoveToFocused => Translator.MailOperation_MoveFocused,
MailOperation.MoveToOther => Translator.MailOperation_MoveOther,
MailOperation.AlwaysMoveToOther => Translator.MailOperation_AlwaysMoveOther,
MailOperation.AlwaysMoveToFocused => Translator.MailOperation_AlwaysMoveFocused,
MailOperation.SetFlag => Translator.MailOperation_SetFlag,
MailOperation.ClearFlag => Translator.MailOperation_ClearFlag,
MailOperation.MarkAsRead => Translator.MailOperation_MarkAsRead,
MailOperation.MarkAsUnread => Translator.MailOperation_MarkAsUnread,
MailOperation.MarkAsNotJunk => Translator.MailOperation_MarkNotJunk,
MailOperation.Seperator => string.Empty,
MailOperation.Ignore => Translator.MailOperation_Ignore,
MailOperation.Reply => Translator.MailOperation_Reply,
MailOperation.ReplyAll => Translator.MailOperation_ReplyAll,
MailOperation.Zoom => Translator.MailOperation_Zoom,
MailOperation.SaveAs => Translator.MailOperation_SaveAs,
MailOperation.Find => Translator.MailOperation_Find,
MailOperation.Forward => Translator.MailOperation_Forward,
MailOperation.DarkEditor => string.Empty,
MailOperation.LightEditor => string.Empty,
MailOperation.Print => Translator.MailOperation_Print,
MailOperation.Navigate => Translator.MailOperation_Navigate,
_ => "unknown",
};
}
public static string GetOperationString(FolderOperation operation)
{
switch (operation)
return operation switch
{
case FolderOperation.None:
break;
case FolderOperation.Pin:
return Translator.FolderOperation_Pin;
case FolderOperation.Unpin:
return Translator.FolderOperation_Unpin;
case FolderOperation.MarkAllAsRead:
return Translator.FolderOperation_MarkAllAsRead;
case FolderOperation.DontSync:
return Translator.FolderOperation_DontSync;
case FolderOperation.Empty:
return Translator.FolderOperation_Empty;
case FolderOperation.Rename:
return Translator.FolderOperation_Rename;
case FolderOperation.Delete:
return Translator.FolderOperation_Delete;
case FolderOperation.Move:
return Translator.FolderOperation_Move;
case FolderOperation.CreateSubFolder:
return Translator.FolderOperation_CreateSubFolder;
}
return string.Empty;
FolderOperation.None => string.Empty,
FolderOperation.Pin => Translator.FolderOperation_Pin,
FolderOperation.Unpin => Translator.FolderOperation_Unpin,
FolderOperation.MarkAllAsRead => Translator.FolderOperation_MarkAllAsRead,
FolderOperation.DontSync => Translator.FolderOperation_DontSync,
FolderOperation.Empty => Translator.FolderOperation_Empty,
FolderOperation.Rename => Translator.FolderOperation_Rename,
FolderOperation.Delete => Translator.FolderOperation_Delete,
FolderOperation.Move => Translator.FolderOperation_Move,
FolderOperation.CreateSubFolder => Translator.FolderOperation_CreateSubFolder,
_ => string.Empty,
};
}
#endregion

View File

@@ -4,7 +4,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:abstract="using:Wino.Views.Abstract"
xmlns:controls="using:Wino.Controls"
xmlns:controls1="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:data="using:Wino.Mail.ViewModels.Data"
xmlns:domain="using:Wino.Core.Domain"
@@ -14,6 +13,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:reader="using:Wino.Core.Domain.Models.Reader"
xmlns:toolkit="using:CommunityToolkit.WinUI.Controls"
x:Name="root"
d:Background="White"
Loaded="ComposerLoaded"
@@ -144,26 +144,22 @@
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="56" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid
x:Name="TopPanelGrid"
Padding="16,6,6,6"
RowSpacing="6">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<CommandBar
Grid.Row="1"
DefaultLabelPosition="Right"
DynamicOverflowItemsChanging="BarDynamicOverflowChanging"
IsDynamicOverflowEnabled="True"
OverflowButtonVisibility="Collapsed">
<CommandBar.PrimaryCommands>
<!-- Format -->
<toolkit:TabbedCommandBar>
<toolkit:TabbedCommandBar.Resources>
<SolidColorBrush x:Key="TabContentContentBorderBackground" Color="Transparent" />
<SolidColorBrush x:Key="TabContentContentBorderBorderBrush" Color="Transparent" />
<Thickness x:Key="TabContentBorderBorderThickness">0</Thickness>
</toolkit:TabbedCommandBar.Resources>
<toolkit:TabbedCommandBar.PaneCustomContent>
<toolkit:TabbedCommandBarItem
CommandAlignment="Right"
IsDynamicOverflowEnabled="True"
OverflowButtonAlignment="Left">
<AppBarButton
Click="InvertComposerThemeClicked"
LabelPosition="Collapsed"
@@ -184,252 +180,229 @@
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton Command="{x:Bind ViewModel.DiscardCommand}" Label="Discard">
<AppBarButton Command="{x:Bind ViewModel.DiscardCommand}" Label="{x:Bind domain:Translator.Buttons_Discard}">
<AppBarButton.Icon>
<controls:WinoFontIcon Icon="Delete" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton Command="{x:Bind ViewModel.SendCommand}" Label="Send">
<AppBarButton Command="{x:Bind ViewModel.SendCommand}" Label="{x:Bind domain:Translator.Buttons_Send}">
<AppBarButton.Icon>
<controls:WinoFontIcon Icon="Send" />
</AppBarButton.Icon>
</AppBarButton>
</CommandBar.PrimaryCommands>
<CommandBar.Content>
<!-- Wino Pivot -->
<controls:WinoPivotControl
ItemsSource="{x:Bind ViewModel.ToolbarSections}"
SelectedItem="{x:Bind ViewModel.SelectedToolbarSection, Mode=TwoWay}"
SelectorPipeColor="{ThemeResource NavigationViewSelectionIndicatorForeground}">
<controls:WinoPivotControl.DataTemplate>
<DataTemplate x:DataType="reader:EditorToolbarSection">
<TextBlock Text="{x:Bind Title}" />
</DataTemplate>
</controls:WinoPivotControl.DataTemplate>
</controls:WinoPivotControl>
</CommandBar.Content>
</CommandBar>
</Grid>
</toolkit:TabbedCommandBarItem>
</toolkit:TabbedCommandBar.PaneCustomContent>
<toolkit:TabbedCommandBar.MenuItems>
<toolkit:TabbedCommandBarItem DefaultLabelPosition="Collapsed" Header="{x:Bind domain:Translator.EditorToolbarOption_Format}">
<AppBarToggleButton
x:Name="BoldButton"
Click="BoldButtonClicked"
Label="Bold">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource BoldPathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarToggleButton
x:Name="ItalicButton"
Click="ItalicButtonClicked"
Label="Italic">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource ItalicPathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarToggleButton
x:Name="UnderlineButton"
Click="UnderlineButtonClicked"
Label="Underline">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource UnderlinePathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarToggleButton
x:Name="StrokeButton"
Click="StrokeButtonClicked"
Label="Stroke">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource StrikePathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<!-- Editor Options -->
<Grid Grid.Row="1" Padding="26,0,6,6">
<CommandBar
HorizontalAlignment="Left"
DefaultLabelPosition="Collapsed"
IsDynamicOverflowEnabled="True"
Visibility="{x:Bind helpers:XamlHelpers.IsFormatSection(ViewModel.SelectedToolbarSection), Mode=OneWay}">
<AppBarToggleButton
x:Name="BoldButton"
Click="BoldButtonClicked"
Label="Bold">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource BoldPathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarToggleButton
x:Name="ItalicButton"
Click="ItalicButtonClicked"
Label="Italic">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource ItalicPathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarToggleButton
x:Name="UnderlineButton"
Click="UnderlineButtonClicked"
Label="Underline">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource UnderlinePathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarToggleButton
x:Name="StrokeButton"
Click="StrokeButtonClicked"
Label="Stroke">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource StrikePathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarSeparator />
<AppBarSeparator />
<AppBarToggleButton
x:Name="BulletListButton"
Click="BulletListButtonClicked"
Label="Bullet List">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource BulletedListPathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarToggleButton
x:Name="BulletListButton"
Click="BulletListButtonClicked"
Label="Bullet List">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource BulletedListPathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarToggleButton
x:Name="OrderedListButton"
Click="OrderedListButtonClicked"
Label="Ordered List">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource OrderedListPathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarToggleButton
x:Name="OrderedListButton"
Click="OrderedListButtonClicked"
Label="Ordered List">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource OrderedListPathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarSeparator />
<AppBarSeparator />
<AppBarButton
x:Name="DecreaseIndentButton"
Click="DecreaseIndentClicked"
Label="Outdent">
<AppBarButton.Content>
<Viewbox Width="16">
<PathIcon Data="{StaticResource DecreaseIndentPathIcon}" />
</Viewbox>
</AppBarButton.Content>
</AppBarButton>
<AppBarButton
x:Name="DecreaseIndentButton"
Click="DecreaseIndentClicked"
Label="Outdent">
<AppBarButton.Content>
<Viewbox Width="16">
<PathIcon Data="{StaticResource DecreaseIndentPathIcon}" />
</Viewbox>
</AppBarButton.Content>
</AppBarButton>
<AppBarButton
x:Name="IncreaseIndentButton"
Click="IncreaseIndentClicked"
Label="Indent">
<AppBarButton.Content>
<Viewbox Width="16">
<PathIcon Data="{StaticResource IncreaseIndentPathIcon}" />
</Viewbox>
</AppBarButton.Content>
</AppBarButton>
<AppBarButton
x:Name="IncreaseIndentButton"
Click="IncreaseIndentClicked"
Label="Indent">
<AppBarButton.Content>
<Viewbox Width="16">
<PathIcon Data="{StaticResource IncreaseIndentPathIcon}" />
</Viewbox>
</AppBarButton.Content>
</AppBarButton>
<AppBarElementContainer HorizontalAlignment="Center" VerticalAlignment="Center">
<ComboBox
x:Name="AlignmentListView"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="Transparent"
SelectionChanged="AlignmentChanged">
<ComboBoxItem IsSelected="True" Tag="left">
<StackPanel Orientation="Horizontal" Spacing="8">
<Viewbox Width="16">
<PathIcon Data="{StaticResource AlignLeftPathIcon}" />
</Viewbox>
<TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Left}" />
</StackPanel>
</ComboBoxItem>
<AppBarElementContainer HorizontalAlignment="Center" VerticalAlignment="Center">
<ComboBox
x:Name="AlignmentListView"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="Transparent"
SelectionChanged="AlignmentChanged">
<ComboBoxItem IsSelected="True" Tag="left">
<StackPanel Orientation="Horizontal" Spacing="8">
<Viewbox Width="16">
<PathIcon Data="{StaticResource AlignLeftPathIcon}" />
</Viewbox>
<TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Left}" />
</StackPanel>
</ComboBoxItem>
<ComboBoxItem Tag="center">
<StackPanel Orientation="Horizontal" Spacing="8">
<Viewbox Width="16">
<PathIcon Data="{StaticResource AlignCenterPathIcon}" />
</Viewbox>
<TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Center}" />
</StackPanel>
</ComboBoxItem>
<ComboBoxItem Tag="center">
<StackPanel Orientation="Horizontal" Spacing="8">
<Viewbox Width="16">
<PathIcon Data="{StaticResource AlignCenterPathIcon}" />
</Viewbox>
<TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Center}" />
</StackPanel>
</ComboBoxItem>
<ComboBoxItem Tag="right">
<StackPanel Orientation="Horizontal" Spacing="8">
<Viewbox Width="16">
<PathIcon Data="{StaticResource AlignRightPathIcon}" />
</Viewbox>
<TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Right}" />
</StackPanel>
</ComboBoxItem>
<ComboBoxItem Tag="right">
<StackPanel Orientation="Horizontal" Spacing="8">
<Viewbox Width="16">
<PathIcon Data="{StaticResource AlignRightPathIcon}" />
</Viewbox>
<TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Right}" />
</StackPanel>
</ComboBoxItem>
<ComboBoxItem Tag="justify">
<StackPanel Orientation="Horizontal" Spacing="8">
<Viewbox Width="16">
<PathIcon Data="{StaticResource AlignJustifyPathIcon}" />
</Viewbox>
<TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Justify}" />
</StackPanel>
</ComboBoxItem>
</ComboBox>
</AppBarElementContainer>
<ComboBoxItem Tag="justify">
<StackPanel Orientation="Horizontal" Spacing="8">
<Viewbox Width="16">
<PathIcon Data="{StaticResource AlignJustifyPathIcon}" />
</Viewbox>
<TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Justify}" />
</StackPanel>
</ComboBoxItem>
</ComboBox>
</AppBarElementContainer>
<AppBarSeparator />
<AppBarSeparator />
<AppBarToggleButton
x:Name="WebviewToolBarButton"
Click="WebViewToggleButtonClicked"
Label="{x:Bind domain:Translator.EditorTooltip_WebViewEditor}"
ToolTipService.ToolTip="{x:Bind domain:Translator.EditorTooltip_WebViewEditor}">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource WebviewToolBarPathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
</toolkit:TabbedCommandBarItem>
<AppBarToggleButton
x:Name="WebviewToolBarButton"
Click="WebViewToggleButtonClicked"
Label="{x:Bind domain:Translator.EditorTooltip_WebViewEditor}"
ToolTipService.ToolTip="{x:Bind domain:Translator.EditorTooltip_WebViewEditor}">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource WebviewToolBarPathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
</CommandBar>
<!-- Insert -->
<toolkit:TabbedCommandBarItem Header="{x:Bind domain:Translator.EditorToolbarOption_Insert}">
<AppBarButton
x:Name="FilesButton"
Click="AddFilesClicked"
Label="{x:Bind domain:Translator.Files}">
<AppBarButton.Icon>
<PathIcon Data="{StaticResource AttachPathIcon}" />
</AppBarButton.Icon>
</AppBarButton>
<!-- Insert Panel -->
<CommandBar
HorizontalAlignment="Left"
DefaultLabelPosition="Right"
IsDynamicOverflowEnabled="True"
Visibility="{x:Bind helpers:XamlHelpers.IsInsertSection(ViewModel.SelectedToolbarSection), Mode=OneWay}">
<AppBarButton
x:Name="FilesButton"
Click="AddFilesClicked"
Label="{x:Bind domain:Translator.Files}">
<AppBarButton.Icon>
<PathIcon Data="{StaticResource AttachPathIcon}" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton
x:Name="AddImageButton"
Click="AddImageClicked"
Label="{x:Bind domain:Translator.Photos}">
<AppBarButton.Icon>
<PathIcon Data="{StaticResource AddPhotoPathIcon}" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton
x:Name="AddImageButton"
Click="AddImageClicked"
Label="{x:Bind domain:Translator.Photos}">
<AppBarButton.Icon>
<PathIcon Data="{StaticResource AddPhotoPathIcon}" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton
x:Name="EmojiButton"
Click="EmojiButtonClicked"
Label="{x:Bind domain:Translator.Emoji}">
<AppBarButton.Icon>
<PathIcon Data="{StaticResource EmojiPathIcon}" />
</AppBarButton.Icon>
</AppBarButton>
</toolkit:TabbedCommandBarItem>
<AppBarButton
x:Name="EmojiButton"
Click="EmojiButtonClicked"
Label="{x:Bind domain:Translator.Emoji}">
<AppBarButton.Icon>
<PathIcon Data="{StaticResource EmojiPathIcon}" />
</AppBarButton.Icon>
</AppBarButton>
</CommandBar>
<!-- Draw Panel -->
<Grid x:Name="DrawPanel" Visibility="{x:Bind helpers:XamlHelpers.IsDrawSection(ViewModel.SelectedToolbarSection), Mode=OneWay}">
<TextBlock Text="{x:Bind domain:Translator.ComingSoon}" />
</Grid>
<!-- Options Panel -->
<Grid x:Name="OptionsPanel" Visibility="{x:Bind helpers:XamlHelpers.IsOptionsSection(ViewModel.SelectedToolbarSection), Mode=OneWay}">
<muxc:ToggleSplitButton x:Name="ImportanceSplitButton" IsChecked="{x:Bind ViewModel.IsImportanceSelected, Mode=TwoWay}">
<SymbolIcon x:Name="ImportanceSplitButtonContent" Symbol="Important" />
<muxc:ToggleSplitButton.Flyout>
<Flyout x:Name="ImportanceFlyout" Placement="Bottom">
<StackPanel Orientation="Horizontal">
<StackPanel.Resources>
<Style TargetType="Button">
<Setter Property="Padding" Value="4" />
<Setter Property="MinWidth" Value="0" />
<Setter Property="MinHeight" Value="0" />
<Setter Property="Margin" Value="6" />
<Setter Property="CornerRadius" Value="{StaticResource ControlCornerRadius}" />
</Style>
</StackPanel.Resources>
<Button Click="ImportanceClicked">
<Button.Tag>
<mailkit:MessageImportance>High</mailkit:MessageImportance>
</Button.Tag>
<SymbolIcon Symbol="Important" />
</Button>
<Button Click="ImportanceClicked">
<Button.Tag>
<mailkit:MessageImportance>Low</mailkit:MessageImportance>
</Button.Tag>
<SymbolIcon Symbol="Download" />
</Button>
</StackPanel>
</Flyout>
</muxc:ToggleSplitButton.Flyout>
</muxc:ToggleSplitButton>
</Grid>
</Grid>
<!-- Options -->
<toolkit:TabbedCommandBarItem Header="{x:Bind domain:Translator.EditorToolbarOption_Options}">
<AppBarElementContainer>
<muxc:ToggleSplitButton x:Name="ImportanceSplitButton" IsChecked="{x:Bind ViewModel.IsImportanceSelected, Mode=TwoWay}">
<FontIcon
FontFamily="Segoe Fluent Icons"
FontSize="16"
Glyph="&#xE8C9;" />
<muxc:ToggleSplitButton.Flyout>
<Flyout x:Name="ImportanceFlyout" Placement="Bottom">
<StackPanel Orientation="Horizontal">
<StackPanel.Resources>
<Style TargetType="Button">
<Setter Property="Padding" Value="4" />
<Setter Property="MinWidth" Value="0" />
<Setter Property="MinHeight" Value="0" />
<Setter Property="Margin" Value="6" />
<Setter Property="CornerRadius" Value="{StaticResource ControlCornerRadius}" />
</Style>
</StackPanel.Resources>
<Button Click="ImportanceClicked">
<Button.Tag>
<mailkit:MessageImportance>High</mailkit:MessageImportance>
</Button.Tag>
<FontIcon FontFamily="Segoe Fluent Icons" Glyph="&#xE8C9;" />
</Button>
<Button Click="ImportanceClicked">
<Button.Tag>
<mailkit:MessageImportance>Low</mailkit:MessageImportance>
</Button.Tag>
<FontIcon FontFamily="Segoe Fluent Icons" Glyph="&#xE8D0;" />
</Button>
</StackPanel>
</Flyout>
</muxc:ToggleSplitButton.Flyout>
</muxc:ToggleSplitButton>
</AppBarElementContainer>
</toolkit:TabbedCommandBarItem>
</toolkit:TabbedCommandBar.MenuItems>
</toolkit:TabbedCommandBar>
<!-- Mime Info -->
<Grid
Grid.Row="2"
Grid.Row="1"
Padding="16,0,16,10"
ColumnSpacing="12"
RowSpacing="3">
@@ -478,7 +451,7 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<controls1:TokenizingTextBox
<toolkit:TokenizingTextBox
x:Name="ToBox"
Grid.Column="0"
VerticalAlignment="Center"
@@ -520,7 +493,7 @@
Text="Cc: "
Visibility="{x:Bind ViewModel.IsCCBCCVisible, Mode=OneWay}" />
<controls1:TokenizingTextBox
<toolkit:TokenizingTextBox
x:Name="CCBox"
Grid.Row="2"
Grid.Column="1"
@@ -543,7 +516,7 @@
Text="Bcc: "
Visibility="{x:Bind ViewModel.IsCCBCCVisible, Mode=OneWay}" />
<controls1:TokenizingTextBox
<toolkit:TokenizingTextBox
x:Name="BccBox"
Grid.Row="3"
Grid.Column="1"
@@ -586,7 +559,7 @@
SelectionMode="None">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<controls1:WrapPanel Orientation="Horizontal" />
<toolkit:WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
@@ -595,7 +568,7 @@
<!-- Dropzone -->
<Grid
Grid.Row="0"
Grid.RowSpan="3"
Grid.RowSpan="2"
AllowDrop="True"
DragLeave="OnFileDropGridDragLeave"
DragOver="OnFileDropGridDragOver"

View File

@@ -26,7 +26,6 @@ using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Xaml.Navigation;
using Wino.Core.Domain;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.Reader;
using Wino.Extensions;
@@ -38,7 +37,6 @@ using Wino.Views.Abstract;
namespace Wino.Views
{
public sealed partial class ComposePage : ComposePageAbstract,
IRecipient<NavigationPaneModeChanged>,
IRecipient<CreateNewComposeMailRequested>,
IRecipient<ApplicationThemeChanged>
{
@@ -170,6 +168,7 @@ namespace Wino.Views
ViewModel.IsDraggingOverFilesDropZone = false;
}
}
private void OnImageDropGridDragEnter(object sender, DragEventArgs e)
{
bool isValid = false;
@@ -557,27 +556,11 @@ namespace Wino.Views
private void DOMLoaded(CoreWebView2 sender, CoreWebView2DOMContentLoadedEventArgs args) => DOMLoadedTask.TrySetResult(true);
void IRecipient<NavigationPaneModeChanged>.Receive(NavigationPaneModeChanged message)
{
if (message.NewMode == MenuPaneMode.Hidden)
TopPanelGrid.Padding = new Thickness(48, 6, 6, 6);
else
TopPanelGrid.Padding = new Thickness(16, 6, 6, 6);
}
async void IRecipient<CreateNewComposeMailRequested>.Receive(CreateNewComposeMailRequested message)
{
await RenderInternalAsync(message.RenderModel.RenderHtml);
}
private void BarDynamicOverflowChanging(CommandBar sender, DynamicOverflowItemsChangingEventArgs args)
{
if (args.Action == CommandBarDynamicOverflowAction.AddingToOverflow)
sender.OverflowButtonVisibility = CommandBarOverflowButtonVisibility.Visible;
else
sender.OverflowButtonVisibility = CommandBarOverflowButtonVisibility.Collapsed;
}
private void ShowCCBCCClicked(object sender, RoutedEventArgs e)
{
ViewModel.IsCCBCCVisible = true;
@@ -641,7 +624,7 @@ namespace Wino.Views
var selectedImportance = (MessageImportance)senderButton.Tag;
ViewModel.SelectedMessageImportance = selectedImportance;
(ImportanceSplitButton.Content as SymbolIcon).Symbol = (senderButton.Content as SymbolIcon).Symbol;
(ImportanceSplitButton.Content as FontIcon).Glyph = (senderButton.Content as FontIcon).Glyph;
}
}

View File

@@ -39,7 +39,7 @@ namespace Wino.Views
IRecipient<ShellStateUpdated>,
IRecipient<DisposeRenderingFrameRequested>
{
private const double RENDERING_COLUMN_MIN_WIDTH = 300;
private const double RENDERING_COLUMN_MIN_WIDTH = 375;
private IStatePersistanceService StatePersistenceService { get; } = App.Current.Services.GetService<IStatePersistanceService>();
private IKeyPressService KeyPressService { get; } = App.Current.Services.GetService<IKeyPressService>();

View File

@@ -25,7 +25,6 @@ namespace Wino.Views
public sealed partial class MailRenderingPage : MailRenderingPageAbstract,
IRecipient<HtmlRenderingRequested>,
IRecipient<CancelRenderingContentRequested>,
IRecipient<NavigationPaneModeChanged>,
IRecipient<ApplicationThemeChanged>,
IRecipient<SaveAsPDFRequested>
{
@@ -208,14 +207,6 @@ namespace Wino.Views
}
}
void IRecipient<NavigationPaneModeChanged>.Receive(NavigationPaneModeChanged message)
{
if (message.NewMode == MenuPaneMode.Hidden)
RendererBar.Margin = new Thickness(48, 6, 6, 6);
else
RendererBar.Margin = new Thickness(16, 6, 6, 6);
}
private async void WebViewNavigationStarting(WebView2 sender, CoreWebView2NavigationStartingEventArgs args)
{
// This is our reader.

View File

@@ -136,28 +136,31 @@
<Version>8.2.2</Version>
</PackageReference>
<PackageReference Include="CommunityToolkit.Uwp.Animations">
<Version>8.0.240109</Version>
<Version>8.1.240821</Version>
</PackageReference>
<PackageReference Include="CommunityToolkit.Uwp.Behaviors">
<Version>8.0.240109</Version>
<Version>8.1.240821</Version>
</PackageReference>
<PackageReference Include="CommunityToolkit.Uwp.Controls.SettingsControls">
<Version>8.0.240109</Version>
<Version>8.1.240821</Version>
</PackageReference>
<PackageReference Include="CommunityToolkit.Uwp.Controls.Sizers">
<Version>8.0.240109</Version>
<Version>8.1.240821</Version>
</PackageReference>
<PackageReference Include="CommunityToolkit.Uwp.Controls.TabbedCommandBar">
<Version>8.1.240821</Version>
</PackageReference>
<PackageReference Include="CommunityToolkit.Uwp.Controls.TokenizingTextBox">
<Version>8.0.240109</Version>
<Version>8.1.240821</Version>
</PackageReference>
<PackageReference Include="EmailValidation">
<Version>1.2.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.AppCenter.Analytics">
<Version>5.0.4</Version>
<Version>5.0.5</Version>
</PackageReference>
<PackageReference Include="Microsoft.AppCenter.Crashes">
<Version>5.0.4</Version>
<Version>5.0.5</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection">
<Version>8.0.0</Version>
@@ -183,16 +186,16 @@
<Version>5.1.2</Version>
</PackageReference>
<PackageReference Include="ReactiveUI">
<Version>19.6.1</Version>
<Version>20.1.1</Version>
</PackageReference>
<PackageReference Include="Serilog">
<Version>3.1.1</Version>
<Version>4.0.1</Version>
</PackageReference>
<PackageReference Include="Serilog.Exceptions">
<Version>8.4.0</Version>
</PackageReference>
<PackageReference Include="sqlite-net-pcl">
<Version>1.8.116</Version>
<Version>1.9.172</Version>
</PackageReference>
<PackageReference Include="Win2D.uwp">
<Version>1.27.1</Version>

View File

@@ -1,10 +0,0 @@
using Wino.Core.Domain.Enums;
namespace Wino.Messaging.Client.Shell
{
/// <summary>
/// When navigation pane mode is changed.
/// </summary>
/// <param name="NewMode">New navigation mode.</param>
public record NavigationPaneModeChanged(MenuPaneMode NewMode);
}

View File

@@ -11,7 +11,7 @@
<Identity
Name="58272BurakKSE.WinoMailPreview"
Publisher="CN=51FBDAF3-E212-4149-89A2-A2636B3BC911"
Version="1.8.3.0" />
Version="1.8.5.0" />
<Extensions>
<!-- Publisher Cache Folders -->

View File

@@ -129,7 +129,7 @@
</ItemGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
<ItemGroup>
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.3233" PrivateAssets="all" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Wino.Mail\Wino.Mail.csproj" />

View File

@@ -31,7 +31,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="H.NotifyIcon.Wpf" Version="2.1.2" />
<PackageReference Include="H.NotifyIcon.Wpf" Version="2.1.3" />
<PackageReference Include="CommunityToolkit.WinUI.Notifications" Version="7.1.2" />
</ItemGroup>
<ItemGroup>