Contacts, thread animation and image preview control improvements.

This commit is contained in:
Burak Kaan Köse
2026-02-09 22:39:30 +01:00
parent e559a79506
commit 0999c71578
26 changed files with 1636 additions and 756 deletions
+35 -4
View File
@@ -715,11 +715,12 @@ public class MailService : BaseDatabaseService, IMailService
mailCopy.SenderContact = await GetSenderContactForAccountAsync(account, mailCopy.FromAddress).ConfigureAwait(false);
mailCopy.FolderId = mailItemFolder.Id;
await SaveContactsForPackageAsync(package).ConfigureAwait(false);
var mimeSaveTask = _mimeFileService.SaveMimeMessageAsync(mailCopy.FileId, mimeMessage, account.Id);
var contactSaveTask = _contactService.SaveAddressInformationAsync(mimeMessage);
var insertMailTask = InsertMailAsync(mailCopy);
await Task.WhenAll(mimeSaveTask, contactSaveTask, insertMailTask).ConfigureAwait(false);
await Task.WhenAll(mimeSaveTask, insertMailTask).ConfigureAwait(false);
}
public async Task CreateMailAsyncEx(Guid accountId, NewMailItemPackage package)
@@ -780,10 +781,11 @@ public class MailService : BaseDatabaseService, IMailService
}
}
// Save contact information.
await _contactService.SaveAddressInformationAsync(mimeMessage).ConfigureAwait(false);
}
// Save contact information extracted from provider API or MIME before insert/update.
await SaveContactsForPackageAsync(package).ConfigureAwait(false);
// Create mail copy in the database.
// Update if exists.
@@ -814,6 +816,35 @@ public class MailService : BaseDatabaseService, IMailService
}
}
private async Task SaveContactsForPackageAsync(NewMailItemPackage package)
{
if (package == null) return;
if (package.Mime != null)
{
await _contactService.SaveAddressInformationAsync(package.Mime).ConfigureAwait(false);
return;
}
var contacts = package.ExtractedContacts?
.Where(c => c != null && !string.IsNullOrWhiteSpace(c.Address))
.ToList() ?? new List<AccountContact>();
var senderAddress = package.Copy?.FromAddress;
if (!string.IsNullOrWhiteSpace(senderAddress))
{
contacts.Add(new AccountContact
{
Address = senderAddress,
Name = string.IsNullOrWhiteSpace(package.Copy?.FromName) ? senderAddress : package.Copy.FromName
});
}
if (contacts.Count == 0) return;
await _contactService.SaveAddressInformationAsync(contacts).ConfigureAwait(false);
}
private async Task<MimeMessage> CreateDraftMimeAsync(MailAccount account, DraftCreationOptions draftCreationOptions)
{
// This unique id is stored in mime headers for Wino to identify remote message with local copy.