* 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>
110 lines
3.3 KiB
C#
110 lines
3.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using Wino.Core.Domain.Entities.Mail;
|
|
using Wino.Core.Domain.Entities.Shared;
|
|
using Wino.Core.Domain.Models.MailItem;
|
|
|
|
namespace Wino.Mail.ViewModels.Data;
|
|
|
|
/// <summary>
|
|
/// Single view model for IMailItem representation.
|
|
/// </summary>
|
|
public partial class MailItemViewModel(MailCopy mailCopy) : ObservableObject, IMailItem
|
|
{
|
|
[ObservableProperty]
|
|
public partial MailCopy MailCopy { get; set; } = mailCopy;
|
|
|
|
public Guid UniqueId => ((IMailItem)MailCopy).UniqueId;
|
|
public string ThreadId => ((IMailItem)MailCopy).ThreadId;
|
|
public string MessageId => ((IMailItem)MailCopy).MessageId;
|
|
public DateTime CreationDate => ((IMailItem)MailCopy).CreationDate;
|
|
public string References => ((IMailItem)MailCopy).References;
|
|
public string InReplyTo => ((IMailItem)MailCopy).InReplyTo;
|
|
|
|
[ObservableProperty]
|
|
public partial bool ThumbnailUpdatedEvent { get; set; } = false;
|
|
|
|
[ObservableProperty]
|
|
public partial bool IsCustomFocused { get; set; }
|
|
|
|
[ObservableProperty]
|
|
public partial bool IsSelected { get; set; }
|
|
|
|
public bool IsFlagged
|
|
{
|
|
get => MailCopy.IsFlagged;
|
|
set => SetProperty(MailCopy.IsFlagged, value, MailCopy, (u, n) => u.IsFlagged = n);
|
|
}
|
|
|
|
public string FromName
|
|
{
|
|
get => string.IsNullOrEmpty(MailCopy.FromName) ? MailCopy.FromAddress : MailCopy.FromName;
|
|
set => SetProperty(MailCopy.FromName, value, MailCopy, (u, n) => u.FromName = n);
|
|
}
|
|
|
|
public bool IsFocused
|
|
{
|
|
get => MailCopy.IsFocused;
|
|
set => SetProperty(MailCopy.IsFocused, value, MailCopy, (u, n) => u.IsFocused = n);
|
|
}
|
|
|
|
public bool IsRead
|
|
{
|
|
get => MailCopy.IsRead;
|
|
set => SetProperty(MailCopy.IsRead, value, MailCopy, (u, n) => u.IsRead = n);
|
|
}
|
|
|
|
public bool IsDraft
|
|
{
|
|
get => MailCopy.IsDraft;
|
|
set => SetProperty(MailCopy.IsDraft, value, MailCopy, (u, n) => u.IsDraft = n);
|
|
}
|
|
|
|
public string DraftId
|
|
{
|
|
get => MailCopy.DraftId;
|
|
set => SetProperty(MailCopy.DraftId, value, MailCopy, (u, n) => u.DraftId = n);
|
|
}
|
|
|
|
public string Id
|
|
{
|
|
get => MailCopy.Id;
|
|
set => SetProperty(MailCopy.Id, value, MailCopy, (u, n) => u.Id = n);
|
|
}
|
|
|
|
public string Subject
|
|
{
|
|
get => MailCopy.Subject;
|
|
set => SetProperty(MailCopy.Subject, value, MailCopy, (u, n) => u.Subject = n);
|
|
}
|
|
|
|
public string PreviewText
|
|
{
|
|
get => MailCopy.PreviewText;
|
|
set => SetProperty(MailCopy.PreviewText, value, MailCopy, (u, n) => u.PreviewText = n);
|
|
}
|
|
|
|
public string FromAddress
|
|
{
|
|
get => MailCopy.FromAddress;
|
|
set => SetProperty(MailCopy.FromAddress, value, MailCopy, (u, n) => u.FromAddress = n);
|
|
}
|
|
|
|
public bool HasAttachments
|
|
{
|
|
get => MailCopy.HasAttachments;
|
|
set => SetProperty(MailCopy.HasAttachments, value, MailCopy, (u, n) => u.HasAttachments = n);
|
|
}
|
|
|
|
public MailItemFolder AssignedFolder => ((IMailItem)MailCopy).AssignedFolder;
|
|
|
|
public MailAccount AssignedAccount => ((IMailItem)MailCopy).AssignedAccount;
|
|
|
|
public Guid FileId => ((IMailItem)MailCopy).FileId;
|
|
|
|
public AccountContact SenderContact => ((IMailItem)MailCopy).SenderContact;
|
|
|
|
public IEnumerable<Guid> GetContainingIds() => new[] { UniqueId };
|
|
}
|