Adding contact details for loaded mails and fixing background notification actions.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
using SQLite;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SQLite;
|
||||
|
||||
namespace Wino.Core.Domain.Entities
|
||||
{
|
||||
@@ -9,23 +9,23 @@ namespace Wino.Core.Domain.Entities
|
||||
/// These values will be inserted during MIME fetch.
|
||||
/// </summary>
|
||||
|
||||
|
||||
// TODO: This can easily evolve to Contact store, just like People app in Windows 10/11.
|
||||
// Do it.
|
||||
public class AddressInformation : IEquatable<AddressInformation>
|
||||
public class AccountContact : IEquatable<AccountContact>
|
||||
{
|
||||
[PrimaryKey]
|
||||
public string Address { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Base64ContactPicture { get; set; }
|
||||
|
||||
public string DisplayName => Address == Name ? Address : $"{Name} <{Address}>";
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return Equals(obj as AddressInformation);
|
||||
return Equals(obj as AccountContact);
|
||||
}
|
||||
|
||||
public bool Equals(AddressInformation other)
|
||||
public bool Equals(AccountContact other)
|
||||
{
|
||||
return !(other is null) &&
|
||||
Address == other.Address &&
|
||||
@@ -40,12 +40,12 @@ namespace Wino.Core.Domain.Entities
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
public static bool operator ==(AddressInformation left, AddressInformation right)
|
||||
public static bool operator ==(AccountContact left, AccountContact right)
|
||||
{
|
||||
return EqualityComparer<AddressInformation>.Default.Equals(left, right);
|
||||
return EqualityComparer<AccountContact>.Default.Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=(AddressInformation left, AddressInformation right)
|
||||
public static bool operator !=(AccountContact left, AccountContact right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
@@ -141,6 +141,15 @@ namespace Wino.Core.Domain.Entities
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
public MailAccount AssignedAccount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Contact information of the sender if exists.
|
||||
/// Warning: This field is not populated by queries.
|
||||
/// Services or View Models are responsible for populating this field.
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
public AccountContact SenderContact { get; set; }
|
||||
|
||||
public IEnumerable<Guid> GetContainingIds() => [UniqueId];
|
||||
public override string ToString() => $"{Subject} <-> {Id}";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user