2025-06-21 01:40:25 +02:00
|
|
|
|
using System;
|
|
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
|
|
using Wino.Core.Domain;
|
2025-02-16 14:38:53 +01:00
|
|
|
|
using Wino.Core.Domain.Entities.Shared;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Wino.Mail.ViewModels.Data;
|
|
|
|
|
|
|
2025-06-21 01:40:25 +02:00
|
|
|
|
public partial class AccountContactViewModel : ObservableObject
|
2025-02-16 14:38:53 +01:00
|
|
|
|
{
|
2025-06-21 01:40:25 +02:00
|
|
|
|
public string Address { get; set; }
|
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
|
public string Base64ContactPicture { get; set; }
|
|
|
|
|
|
public bool IsRootContact { get; set; }
|
|
|
|
|
|
|
2025-02-16 14:38:53 +01:00
|
|
|
|
public AccountContactViewModel(AccountContact contact)
|
|
|
|
|
|
{
|
|
|
|
|
|
Address = contact.Address;
|
|
|
|
|
|
Name = contact.Name;
|
|
|
|
|
|
Base64ContactPicture = contact.Base64ContactPicture;
|
|
|
|
|
|
IsRootContact = contact.IsRootContact;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets or sets whether the contact is the current account.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsMe { get; set; }
|
|
|
|
|
|
|
2025-02-18 20:51:02 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets or sets whether the ShortNameOrYOu should have semicolon.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsSemicolon { get; set; } = true;
|
|
|
|
|
|
|
2025-02-16 14:38:53 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Provides a short name of the contact.
|
|
|
|
|
|
/// <see cref="ShortDisplayName"/> or "You"
|
|
|
|
|
|
/// </summary>
|
2025-02-18 20:51:02 +01:00
|
|
|
|
public string ShortNameOrYou => (IsMe ? Translator.AccountContactNameYou : ShortDisplayName) + (IsSemicolon ? ";" : string.Empty);
|
2025-02-16 14:38:53 +01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Short display name of the contact.
|
|
|
|
|
|
/// Either Name or Address.
|
|
|
|
|
|
/// </summary>
|
2025-02-18 20:51:02 +01:00
|
|
|
|
public string ShortDisplayName => Address == Name || string.IsNullOrWhiteSpace(Name) ? $"{Address.ToLowerInvariant()}" : $"{Name}";
|
2025-02-16 14:38:53 +01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Display name of the contact in a format: Name <Address>.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string DisplayName => Address == Name || string.IsNullOrWhiteSpace(Name) ? Address.ToLowerInvariant() : $"{Name} <{Address.ToLowerInvariant()}>";
|
2025-06-21 01:40:25 +02:00
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
public partial bool ThumbnailUpdatedEvent { get; set; }
|
2025-02-16 14:38:53 +01:00
|
|
|
|
}
|