Resolving conflicts.

This commit is contained in:
Burak Kaan Köse
2026-04-05 16:53:51 +02:00
parent ef85ce6947
commit 323bbf7ea3
3 changed files with 5 additions and 51 deletions
@@ -11,6 +11,10 @@ namespace Wino.Core.Requests.Folder;
public record MarkFolderAsReadRequest(MailItemFolder Folder, List<MailCopy> MailsToMarkRead) : FolderRequestBase(Folder, FolderSynchronizerOperation.MarkFolderRead), ICustomFolderSynchronizationRequest
{
public List<Guid> SynchronizationFolderIds => [Folder.Id];
public bool ExcludeMustHaveFolders => true;
public override void ApplyUIChanges()
{
if (MailsToMarkRead == null || MailsToMarkRead.Count == 0) return;
@@ -21,7 +25,6 @@ public record MarkFolderAsReadRequest(MailItemFolder Folder, List<MailCopy> Mail
if (item.IsRead) continue;
item.IsRead = true;
}
WeakReferenceMessenger.Default.Send(new MailUpdatedMessage(item, MailUpdateSource.ClientUpdated, MailCopyChangeFlags.IsRead));
}
@@ -37,13 +40,8 @@ public record MarkFolderAsReadRequest(MailItemFolder Folder, List<MailCopy> Mail
if (!item.IsRead) continue;
item.IsRead = false;
}
WeakReferenceMessenger.Default.Send(new MailUpdatedMessage(item, MailUpdateSource.ClientReverted, MailCopyChangeFlags.IsRead));
}
}
public List<Guid> SynchronizationFolderIds => [Folder.Id];
public bool ExcludeMustHaveFolders => true;
}
+1 -32
View File
@@ -880,38 +880,7 @@ public partial class MailListPageViewModel : MailBaseViewModel,
listManipulationSemepahore.Release();
}
// await ExecuteUIThread(() => { SetupTopBarActions(); });
}
protected override async void OnMailUpdated(IReadOnlyList<MailCopy> updatedMails)
{
base.OnMailUpdated(updatedMails);
if (updatedMails == null || updatedMails.Count == 0) return;
// Bulk update: do all changes in a single UI-thread invocation to avoid UI lockups when
// thousands of MailUpdatedMessage events would otherwise be processed one by one.
await ExecuteUIThread(() =>
{
foreach (var mail in updatedMails)
{
if (mail == null) continue;
// Avoid work for items not in the list.
if (!MailCollection.MailCopyIdHashSet.Contains(mail.UniqueId))
continue;
var container = MailCollection.GetMailItemContainer(mail.UniqueId);
if (container?.ItemViewModel != null)
{
container.ItemViewModel.MailCopy = mail;
container.ThreadViewModel?.NotifyPropertyChanges();
}
}
SetupTopBarActions();
});
await ExecuteUIThread(() => { SetupTopBarActions(); });
}
protected override async void OnMailRemoved(MailCopy removedMail)
@@ -652,19 +652,6 @@ public partial class MailRenderingPageViewModel : MailBaseViewModel,
await ExecuteUIThread(() => { InitializeCommandBarItems(); });
}
protected override async void OnMailUpdated(IReadOnlyList<MailCopy> updatedMails)
{
base.OnMailUpdated(updatedMails);
if (initializedMailItemViewModel == null || updatedMails == null || updatedMails.Count == 0) return;
// Only care about the currently rendered item.
if (updatedMails.Any(m => m?.UniqueId == initializedMailItemViewModel.UniqueId))
{
await ExecuteUIThread(() => { InitializeCommandBarItems(); });
}
}
[RelayCommand]
private async Task OpenAttachmentAsync(MailAttachmentViewModel attachmentViewModel)
{