feat: Enhanced sender avatars with gravatar and favicons integration (#685)
* feat: Enhanced sender avatars with gravatar and favicons integration * chore: Remove unused known companies thumbnails * feat(thumbnail): add IThumbnailService and refactor usage - Introduced a new interface `IThumbnailService` for handling thumbnail-related functionalities. - Registered `IThumbnailService` with its implementation `ThumbnailService` in the service container. - Updated `NotificationBuilder` to use an instance of `IThumbnailService` instead of static methods. - Refactored `ThumbnailService` from a static class to a regular class with instance methods and variables. - Modified `ImagePreviewControl` to utilize the new `IThumbnailService` instance. - Completed integration of `IThumbnailService` in the application by registering it in `App.xaml.cs`. * style: Show favicons as squares - Changed `hintCrop` in `NotificationBuilder` to `None` for app logo display. - Added `FaviconSquircle`, `FaviconImage`, and `isFavicon` to `ImagePreviewControl` for favicon handling. - Updated `UpdateInformation` method to manage favicon visibility. - Introduced `GetBitmapImageAsync` for converting Base64 to Bitmap images. - Enhanced XAML to include `FaviconSquircle` for improved UI appearance. * refactor thumbnail service * Removed old code and added clear method * added prefetch function * Change key from host to email * Remove redundant code * Test event * Fixed an issue with the thumbnail updated event. * Fix cutted favicons * exclude some domain from favicons * add yandex.ru * fix buttons in settings * remove prefetch method * Added thumbnails propagation to mailRenderingPage * Revert MailItemViewModel to object * Remove redundant code * spaces * await load parameter added * fix spaces * fix case sensativity for mail list thumbnails * change duckdns to google * Some cleanup. --------- Co-authored-by: Aleh Khantsevich <aleh.khantsevich@gmail.com> Co-authored-by: Burak Kaan Köse <bkaankose@outlook.com>
This commit is contained in:
committed by
GitHub
parent
a8cb332232
commit
256fd1cce2
@@ -25,12 +25,14 @@ using Wino.Mail.ViewModels.Data;
|
||||
using Wino.Mail.ViewModels.Messages;
|
||||
using Wino.Messaging.Client.Mails;
|
||||
using Wino.Messaging.Server;
|
||||
using Wino.Messaging.UI;
|
||||
using IMailService = Wino.Core.Domain.Interfaces.IMailService;
|
||||
|
||||
namespace Wino.Mail.ViewModels;
|
||||
|
||||
public partial class MailRenderingPageViewModel : MailBaseViewModel,
|
||||
IRecipient<NewMailItemRenderingRequestedEvent>,
|
||||
IRecipient<ThumbnailAdded>,
|
||||
ITransferProgress // For listening IMAP message download progress.
|
||||
{
|
||||
private readonly IMailDialogService _dialogService;
|
||||
@@ -788,4 +790,27 @@ public partial class MailRenderingPageViewModel : MailBaseViewModel,
|
||||
Log.Error(ex, "Failed to render mail.");
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(ThumbnailAdded message)
|
||||
{
|
||||
UpdateThumbnails(ToItems, message.Email);
|
||||
UpdateThumbnails(CcItems, message.Email);
|
||||
UpdateThumbnails(BccItems, message.Email);
|
||||
}
|
||||
|
||||
private void UpdateThumbnails(ObservableCollection<AccountContactViewModel> items, string email)
|
||||
{
|
||||
if (Dispatcher == null || items.Count == 0) return;
|
||||
|
||||
Dispatcher.ExecuteOnUIThread(() =>
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (item.Address.Equals(email, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
item.ThumbnailUpdatedEvent = !item.ThumbnailUpdatedEvent;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user