Get rid of the mail item queue system. Go back to 6 months initial sync strategy.
This commit is contained in:
@@ -287,7 +287,7 @@ public class WinoMailCollection : ObservableRecipient, IRecipient<SelectedItemsC
|
||||
}
|
||||
else
|
||||
{
|
||||
await ExecuteUIThread(() => { threadViewModel.NotifyPropertyChanges(); });
|
||||
await ExecuteUIThread(() => { threadViewModel.ThreadEmails = threadViewModel.ThreadEmails; });
|
||||
}
|
||||
|
||||
UpdateUniqueIdHashes(new MailItemViewModel(addedItem), true);
|
||||
@@ -391,9 +391,13 @@ public class WinoMailCollection : ObservableRecipient, IRecipient<SelectedItemsC
|
||||
private async Task UpdateExistingItemAsync(MailItemViewModel existingItem, MailCopy updatedItem)
|
||||
{
|
||||
UpdateUniqueIdHashes(existingItem, false);
|
||||
UpdateUniqueIdHashes(new MailItemViewModel(updatedItem), true);
|
||||
|
||||
await ExecuteUIThread(() => { existingItem.NotifyPropertyChanges(); });
|
||||
|
||||
await ExecuteUIThread(() =>
|
||||
{
|
||||
existingItem.MailCopy = updatedItem;
|
||||
});
|
||||
|
||||
UpdateUniqueIdHashes(existingItem, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -520,8 +524,8 @@ public class WinoMailCollection : ObservableRecipient, IRecipient<SelectedItemsC
|
||||
foreach (var (existing, updated) in itemsToUpdate)
|
||||
{
|
||||
UpdateUniqueIdHashes(existing, false);
|
||||
UpdateUniqueIdHashes(new MailItemViewModel(updated), true);
|
||||
existing.NotifyPropertyChanges();
|
||||
existing.MailCopy = updated;
|
||||
UpdateUniqueIdHashes(existing, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -684,17 +688,18 @@ public class WinoMailCollection : ObservableRecipient, IRecipient<SelectedItemsC
|
||||
if (itemContainer.ItemViewModel != null)
|
||||
{
|
||||
UpdateUniqueIdHashes(itemContainer.ItemViewModel, false);
|
||||
|
||||
// Update the MailCopy - this will automatically notify all dependent properties
|
||||
itemContainer.ItemViewModel.MailCopy = updatedMailCopy;
|
||||
|
||||
UpdateUniqueIdHashes(itemContainer.ItemViewModel, true);
|
||||
}
|
||||
|
||||
if (itemContainer.ItemViewModel != null)
|
||||
// Trigger thread property notifications if this item is in a thread
|
||||
if (itemContainer.ThreadViewModel != null)
|
||||
{
|
||||
itemContainer.ItemViewModel.NotifyPropertyChanges();
|
||||
itemContainer.ThreadViewModel.ThreadEmails = itemContainer.ThreadViewModel.ThreadEmails;
|
||||
}
|
||||
|
||||
UpdateUniqueIdHashes(new MailItemViewModel(updatedMailCopy), true);
|
||||
|
||||
// Call thread notifications if possible.
|
||||
itemContainer.ThreadViewModel?.NotifyPropertyChanges();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -559,7 +559,7 @@ public partial class ComposePageViewModel : MailBaseViewModel
|
||||
{
|
||||
await ExecuteUIThread(() =>
|
||||
{
|
||||
CurrentMailDraftItem.NotifyPropertyChanges();
|
||||
CurrentMailDraftItem.MailCopy = updatedMail;
|
||||
DiscardCommand.NotifyCanExecuteChanged();
|
||||
SendCommand.NotifyCanExecuteChanged();
|
||||
});
|
||||
|
||||
@@ -11,7 +11,29 @@ namespace Wino.Mail.ViewModels.Data;
|
||||
/// </summary>
|
||||
public partial class MailItemViewModel(MailCopy mailCopy) : ObservableRecipient, IMailListItem
|
||||
{
|
||||
public MailCopy MailCopy { get; } = mailCopy;
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(CreationDate))]
|
||||
[NotifyPropertyChangedFor(nameof(IsFlagged))]
|
||||
[NotifyPropertyChangedFor(nameof(FromName))]
|
||||
[NotifyPropertyChangedFor(nameof(IsFocused))]
|
||||
[NotifyPropertyChangedFor(nameof(IsRead))]
|
||||
[NotifyPropertyChangedFor(nameof(IsDraft))]
|
||||
[NotifyPropertyChangedFor(nameof(DraftId))]
|
||||
[NotifyPropertyChangedFor(nameof(Id))]
|
||||
[NotifyPropertyChangedFor(nameof(Subject))]
|
||||
[NotifyPropertyChangedFor(nameof(PreviewText))]
|
||||
[NotifyPropertyChangedFor(nameof(FromAddress))]
|
||||
[NotifyPropertyChangedFor(nameof(HasAttachments))]
|
||||
[NotifyPropertyChangedFor(nameof(Importance))]
|
||||
[NotifyPropertyChangedFor(nameof(ThreadId))]
|
||||
[NotifyPropertyChangedFor(nameof(MessageId))]
|
||||
[NotifyPropertyChangedFor(nameof(References))]
|
||||
[NotifyPropertyChangedFor(nameof(InReplyTo))]
|
||||
[NotifyPropertyChangedFor(nameof(FileId))]
|
||||
[NotifyPropertyChangedFor(nameof(FolderId))]
|
||||
[NotifyPropertyChangedFor(nameof(UniqueId))]
|
||||
[NotifyPropertyChangedFor(nameof(Base64ContactPicture))]
|
||||
public partial MailCopy MailCopy { get; set; } = mailCopy;
|
||||
|
||||
[ObservableProperty]
|
||||
public partial bool IsDisplayedInThread { get; set; }
|
||||
@@ -149,32 +171,6 @@ public partial class MailItemViewModel(MailCopy mailCopy) : ObservableRecipient,
|
||||
set => SetProperty(MailCopy.SenderContact.Base64ContactPicture, value, MailCopy, (u, n) => u.SenderContact.Base64ContactPicture = n);
|
||||
}
|
||||
|
||||
public void NotifyPropertyChanges()
|
||||
{
|
||||
// Raise on property changes for all observable properties.
|
||||
OnPropertyChanged(nameof(CreationDate));
|
||||
OnPropertyChanged(nameof(IsFlagged));
|
||||
OnPropertyChanged(nameof(FromName));
|
||||
OnPropertyChanged(nameof(IsFocused));
|
||||
OnPropertyChanged(nameof(IsRead));
|
||||
OnPropertyChanged(nameof(IsDraft));
|
||||
OnPropertyChanged(nameof(DraftId));
|
||||
OnPropertyChanged(nameof(Id));
|
||||
OnPropertyChanged(nameof(Subject));
|
||||
OnPropertyChanged(nameof(PreviewText));
|
||||
OnPropertyChanged(nameof(FromAddress));
|
||||
OnPropertyChanged(nameof(HasAttachments));
|
||||
OnPropertyChanged(nameof(Importance));
|
||||
OnPropertyChanged(nameof(ThreadId));
|
||||
OnPropertyChanged(nameof(MessageId));
|
||||
OnPropertyChanged(nameof(References));
|
||||
OnPropertyChanged(nameof(InReplyTo));
|
||||
OnPropertyChanged(nameof(FileId));
|
||||
OnPropertyChanged(nameof(FolderId));
|
||||
OnPropertyChanged(nameof(UniqueId));
|
||||
OnPropertyChanged(nameof(Base64ContactPicture));
|
||||
}
|
||||
|
||||
public IEnumerable<Guid> GetContainingIds() => [MailCopy.UniqueId];
|
||||
|
||||
public IEnumerable<MailItemViewModel> GetSelectedMailItems()
|
||||
|
||||
@@ -141,6 +141,28 @@ public partial class ThreadMailItemViewModel : ObservableRecipient, IMailListIte
|
||||
/// </summary>
|
||||
///
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(EmailCount))]
|
||||
[NotifyPropertyChangedFor(nameof(Subject))]
|
||||
[NotifyPropertyChangedFor(nameof(FromName))]
|
||||
[NotifyPropertyChangedFor(nameof(CreationDate))]
|
||||
[NotifyPropertyChangedFor(nameof(FromAddress))]
|
||||
[NotifyPropertyChangedFor(nameof(PreviewText))]
|
||||
[NotifyPropertyChangedFor(nameof(HasAttachments))]
|
||||
[NotifyPropertyChangedFor(nameof(IsFlagged))]
|
||||
[NotifyPropertyChangedFor(nameof(IsFocused))]
|
||||
[NotifyPropertyChangedFor(nameof(IsRead))]
|
||||
[NotifyPropertyChangedFor(nameof(IsDraft))]
|
||||
[NotifyPropertyChangedFor(nameof(DraftId))]
|
||||
[NotifyPropertyChangedFor(nameof(Id))]
|
||||
[NotifyPropertyChangedFor(nameof(Importance))]
|
||||
[NotifyPropertyChangedFor(nameof(ThreadId))]
|
||||
[NotifyPropertyChangedFor(nameof(MessageId))]
|
||||
[NotifyPropertyChangedFor(nameof(References))]
|
||||
[NotifyPropertyChangedFor(nameof(InReplyTo))]
|
||||
[NotifyPropertyChangedFor(nameof(FileId))]
|
||||
[NotifyPropertyChangedFor(nameof(FolderId))]
|
||||
[NotifyPropertyChangedFor(nameof(UniqueId))]
|
||||
[NotifyPropertyChangedFor(nameof(Base64ContactPicture))]
|
||||
public partial ObservableCollection<MailItemViewModel> ThreadEmails { get; set; } = [];
|
||||
|
||||
private MailItemViewModel latestMailViewModel => ThreadEmails.OrderByDescending(e => e.MailCopy?.CreationDate).FirstOrDefault()!;
|
||||
@@ -150,33 +172,6 @@ public partial class ThreadMailItemViewModel : ObservableRecipient, IMailListIte
|
||||
_threadId = threadId;
|
||||
}
|
||||
|
||||
public void NotifyPropertyChanges()
|
||||
{
|
||||
OnPropertyChanged(nameof(Subject));
|
||||
OnPropertyChanged(nameof(FromName));
|
||||
OnPropertyChanged(nameof(CreationDate));
|
||||
OnPropertyChanged(nameof(FromAddress));
|
||||
OnPropertyChanged(nameof(PreviewText));
|
||||
OnPropertyChanged(nameof(HasAttachments));
|
||||
OnPropertyChanged(nameof(IsFlagged));
|
||||
OnPropertyChanged(nameof(IsFocused));
|
||||
OnPropertyChanged(nameof(IsRead));
|
||||
OnPropertyChanged(nameof(IsDraft));
|
||||
OnPropertyChanged(nameof(DraftId));
|
||||
OnPropertyChanged(nameof(Id));
|
||||
OnPropertyChanged(nameof(Importance));
|
||||
OnPropertyChanged(nameof(ThreadId));
|
||||
OnPropertyChanged(nameof(MessageId));
|
||||
OnPropertyChanged(nameof(References));
|
||||
OnPropertyChanged(nameof(InReplyTo));
|
||||
OnPropertyChanged(nameof(FileId));
|
||||
OnPropertyChanged(nameof(FolderId));
|
||||
OnPropertyChanged(nameof(UniqueId));
|
||||
OnPropertyChanged(nameof(ThreadEmails));
|
||||
OnPropertyChanged(nameof(EmailCount));
|
||||
OnPropertyChanged(nameof(Base64ContactPicture));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an email to this thread
|
||||
/// </summary>
|
||||
@@ -186,7 +181,8 @@ public partial class ThreadMailItemViewModel : ObservableRecipient, IMailListIte
|
||||
throw new ArgumentException($"Email ThreadId '{email.MailCopy.ThreadId}' does not match expander ThreadId '{_threadId}'");
|
||||
|
||||
ThreadEmails.Add(email);
|
||||
NotifyPropertyChanges();
|
||||
// Reassign to trigger property change notifications
|
||||
ThreadEmails = ThreadEmails;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -196,7 +192,8 @@ public partial class ThreadMailItemViewModel : ObservableRecipient, IMailListIte
|
||||
{
|
||||
if (ThreadEmails.Remove(email))
|
||||
{
|
||||
NotifyPropertyChanges();
|
||||
// Reassign to trigger property change notifications
|
||||
ThreadEmails = ThreadEmails;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user