Reworked aliases.
This commit is contained in:
@@ -78,18 +78,20 @@ namespace Wino.Core.Domain.Entities
|
||||
[Ignore]
|
||||
public CustomServerInformation ServerInformation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the aliases of the account.
|
||||
/// It's only synchronized for Gmail right now.
|
||||
/// Other provider types are manually added by users and not verified.
|
||||
/// </summary>
|
||||
//[Ignore]
|
||||
//public List<MailAccountAlias> Aliases { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Account preferences.
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
public MailAccountPreferences Preferences { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the account can perform ProfileInformation sync type.
|
||||
/// </summary>
|
||||
public bool IsProfileInfoSyncSupported => ProviderType == MailProviderType.Outlook || ProviderType == MailProviderType.Office365 || ProviderType == MailProviderType.Gmail;
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the account can perform AliasInformation sync type.
|
||||
/// </summary>
|
||||
public bool IsAliasSyncSupported => ProviderType == MailProviderType.Gmail;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SQLite;
|
||||
|
||||
namespace Wino.Core.Domain.Entities
|
||||
{
|
||||
public class MailAccountAlias
|
||||
public class RemoteAccountAlias
|
||||
{
|
||||
/// <summary>
|
||||
/// Unique Id for the alias.
|
||||
/// </summary>
|
||||
[PrimaryKey]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Account id that this alias is attached to.
|
||||
/// </summary>
|
||||
public Guid AccountId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Display address of the alias.
|
||||
/// </summary>
|
||||
@@ -32,13 +20,6 @@ namespace Wino.Core.Domain.Entities
|
||||
/// </summary>
|
||||
public bool IsPrimary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether this alias is the root alias for the account.
|
||||
/// Root alias means the first alias that was created for the account.
|
||||
/// It can't be deleted or changed.
|
||||
/// </summary>
|
||||
public bool IsRootAlias { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the alias is verified by the server.
|
||||
/// Non-verified aliases will show an info tip to users during sending.
|
||||
@@ -47,37 +28,30 @@ namespace Wino.Core.Domain.Entities
|
||||
/// </summary>
|
||||
public bool IsVerified { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether this alias is the root alias for the account.
|
||||
/// Root alias means the first alias that was created for the account.
|
||||
/// It can't be deleted or changed.
|
||||
/// </summary>
|
||||
public bool IsRootAlias { get; set; }
|
||||
}
|
||||
|
||||
public class MailAccountAlias : RemoteAccountAlias
|
||||
{
|
||||
/// <summary>
|
||||
/// Unique Id for the alias.
|
||||
/// </summary>
|
||||
[PrimaryKey]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Account id that this alias is attached to.
|
||||
/// </summary>
|
||||
public Guid AccountId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Root aliases can't be deleted.
|
||||
/// </summary>
|
||||
public bool CanDelete => !IsRootAlias;
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null || GetType() != obj.GetType())
|
||||
return false;
|
||||
|
||||
var other = (MailAccountAlias)obj;
|
||||
return other != null &&
|
||||
AccountId == other.AccountId &&
|
||||
AliasAddress == other.AliasAddress &&
|
||||
ReplyToAddress == other.ReplyToAddress &&
|
||||
IsPrimary == other.IsPrimary &&
|
||||
IsVerified == other.IsVerified &&
|
||||
IsRootAlias == other.IsRootAlias;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int hashCode = 59052167;
|
||||
hashCode = hashCode * -1521134295 + AccountId.GetHashCode();
|
||||
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(AliasAddress);
|
||||
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(ReplyToAddress);
|
||||
hashCode = hashCode * -1521134295 + IsPrimary.GetHashCode();
|
||||
hashCode = hashCode * -1521134295 + IsRootAlias.GetHashCode();
|
||||
hashCode = hashCode * -1521134295 + IsVerified.GetHashCode();
|
||||
hashCode = hashCode * -1521134295 + CanDelete.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user