Code Quality: Fixed multiple paddings, disabled backspace addon (#354)

* Changed paddings and size for unsubscribe button to avoid shifts

* Fix bottom paddings

* Disable backspace addon, simplify attachments logic, convert switches

* Remove redundant code from Mail Rendering page

* Replace Font Icon to Path
This commit is contained in:
Tiktack
2024-09-10 10:14:13 +02:00
committed by GitHub
parent 7715d4bdda
commit 7761cf6dbe
4 changed files with 76 additions and 174 deletions

View File

@@ -81,8 +81,6 @@ namespace Wino.Mail.ViewModels
}
}
public bool HasMultipleAttachments => Attachments.Count > 1;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(ShouldDisplayDownloadProgress))]
private bool isIndetermineProgress;
@@ -295,14 +293,14 @@ namespace Wino.Mail.ViewModels
{
base.OnNavigatedTo(mode, parameters);
Attachments.CollectionChanged -= AttachmentsUpdated;
Attachments.CollectionChanged += AttachmentsUpdated;
renderCancellationTokenSource.Cancel();
initializedMailItemViewModel = null;
initializedMimeMessageInformation = null;
// Dispose existing content first.
Messenger.Send(new CancelRenderingContentRequested());
// This page can be accessed for 2 purposes.
// 1. Rendering a mail item when the user selects.
// 2. Rendering an existing EML file with MimeMessage.
@@ -313,8 +311,6 @@ namespace Wino.Mail.ViewModels
// Configure common rendering properties first.
IsDarkWebviewRenderer = _underlyingThemeService.IsUnderlyingThemeDark();
await ResetPagePropertiesAsync();
renderCancellationTokenSource = new CancellationTokenSource();
// Mime content might not be available for now and might require a download.
@@ -340,11 +336,6 @@ namespace Wino.Mail.ViewModels
}
}
private async void AttachmentsUpdated(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
await ExecuteUIThread(() => { OnPropertyChanged(nameof(HasMultipleAttachments)); });
}
private async Task HandleSingleItemDownloadAsync(MailItemViewModel mailItemViewModel)
{
try
@@ -371,6 +362,7 @@ namespace Wino.Mail.ViewModels
private async Task RenderAsync(MailItemViewModel mailItemViewModel, CancellationToken cancellationToken = default)
{
ResetProgress();
var isMimeExists = await _mimeFileService.IsMimeExistAsync(mailItemViewModel.AssignedAccount.Id, mailItemViewModel.MailCopy.FileId);
if (!isMimeExists)
@@ -460,8 +452,6 @@ namespace Wino.Mail.ViewModels
{
base.OnNavigatedFrom(mode, parameters);
Attachments.CollectionChanged -= AttachmentsUpdated;
renderCancellationTokenSource.Cancel();
CurrentDownloadPercentage = 0d;
@@ -470,12 +460,6 @@ namespace Wino.Mail.ViewModels
forceImageLoading = false;
ToItems.Clear();
CCItemsItems.Clear();
BCCItems.Clear();
Attachments.Clear();
MenuItems.Clear();
StatePersistenceService.IsReadingMail = false;
}
@@ -501,22 +485,6 @@ namespace Wino.Mail.ViewModels
IsIndetermineProgress = false;
}
private async Task ResetPagePropertiesAsync()
{
await ExecuteUIThread(() =>
{
ResetProgress();
ToItems.Clear();
CCItemsItems.Clear();
BCCItems.Clear();
Attachments.Clear();
// Dispose existing content first.
Messenger.Send(new CancelRenderingContentRequested());
});
}
private void InitializeCommandBarItems()
{
MenuItems.Clear();