Improve alias capability model and Outlook alias sync
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using SQLite;
|
||||
using Wino.Core.Domain;
|
||||
using Wino.Core.Domain.Enums;
|
||||
|
||||
namespace Wino.Core.Domain.Entities.Mail;
|
||||
|
||||
@@ -42,6 +44,16 @@ public class RemoteAccountAlias
|
||||
/// Used for Gmail only.
|
||||
/// </summary>
|
||||
public string AliasSenderName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the alias was entered by the user or discovered from the provider.
|
||||
/// </summary>
|
||||
public AliasSource Source { get; set; } = AliasSource.Manual;
|
||||
|
||||
/// <summary>
|
||||
/// Represents Wino's confidence that the alias can be used for sending.
|
||||
/// </summary>
|
||||
public AliasSendCapability SendCapability { get; set; } = AliasSendCapability.Unknown;
|
||||
}
|
||||
|
||||
public class MailAccountAlias : RemoteAccountAlias
|
||||
@@ -70,4 +82,28 @@ public class MailAccountAlias : RemoteAccountAlias
|
||||
|
||||
[Ignore]
|
||||
public ObservableCollection<X509Certificate2> Certificates { get; set; } = [];
|
||||
|
||||
[Ignore]
|
||||
public bool IsCapabilityConfirmed => SendCapability == AliasSendCapability.Confirmed;
|
||||
|
||||
[Ignore]
|
||||
public bool IsCapabilityUnknown => SendCapability == AliasSendCapability.Unknown;
|
||||
|
||||
[Ignore]
|
||||
public bool IsCapabilityDenied => SendCapability == AliasSendCapability.Denied;
|
||||
|
||||
[Ignore]
|
||||
public string CapabilityDisplayName => SendCapability switch
|
||||
{
|
||||
AliasSendCapability.Confirmed => Translator.AccountAlias_Status_Confirmed,
|
||||
AliasSendCapability.Denied => Translator.AccountAlias_Status_Denied,
|
||||
_ => Translator.AccountAlias_Status_Unknown
|
||||
};
|
||||
|
||||
[Ignore]
|
||||
public string SourceDisplayName => Source switch
|
||||
{
|
||||
AliasSource.ProviderDiscovered => Translator.AccountAlias_Source_ProviderDiscovered,
|
||||
_ => Translator.AccountAlias_Source_Manual
|
||||
};
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class MailAccount
|
||||
/// <summary>
|
||||
/// Gets whether the account can perform AliasInformation sync type.
|
||||
/// </summary>
|
||||
public bool IsAliasSyncSupported => ProviderType == MailProviderType.Gmail;
|
||||
public bool IsAliasSyncSupported => ProviderType == MailProviderType.Gmail || ProviderType == MailProviderType.Outlook;
|
||||
|
||||
public override string ToString() => Name;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Wino.Core.Domain.Enums;
|
||||
|
||||
public enum AliasSendCapability
|
||||
{
|
||||
Unknown = 0,
|
||||
Confirmed = 1,
|
||||
Denied = 2
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Wino.Core.Domain.Enums;
|
||||
|
||||
public enum AliasSource
|
||||
{
|
||||
Manual = 0,
|
||||
ProviderDiscovered = 1
|
||||
}
|
||||
@@ -147,6 +147,7 @@ public interface IAccountService
|
||||
/// <param name="accountId">Account id.</param>
|
||||
/// <returns>Primary alias for the account.</returns>
|
||||
Task<MailAccountAlias> GetPrimaryAccountAliasAsync(Guid accountId);
|
||||
Task UpdateAliasSendCapabilityAsync(Guid accountId, string aliasAddress, AliasSendCapability capability);
|
||||
Task<bool> IsAccountFocusedEnabledAsync(Guid accountId);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
{
|
||||
"AccountAlias_Column_Alias": "Alias",
|
||||
"AccountAlias_Column_IsPrimaryAlias": "Primary",
|
||||
"AccountAlias_Column_Verified": "Verified",
|
||||
"AccountAlias_Disclaimer_FirstLine": "Wino can only import aliases for your Gmail accounts.",
|
||||
"AccountAlias_Disclaimer_SecondLine": "If you want to use aliases for your Outlook or IMAP account, please add them yourself.",
|
||||
"AccountAlias_Column_Status": "Status",
|
||||
"AccountAlias_Disclaimer_FirstLine": "Wino can import Gmail aliases directly and can best-effort discover Outlook aliases from Microsoft Graph.",
|
||||
"AccountAlias_Disclaimer_SecondLine": "Manual aliases are still available for Outlook or IMAP when the provider can't confirm sending capability ahead of time.",
|
||||
"AccountAlias_Source_Manual": "Manual",
|
||||
"AccountAlias_Source_ProviderDiscovered": "Provider discovered",
|
||||
"AccountAlias_Status_Confirmed": "Ready to send",
|
||||
"AccountAlias_Status_Unknown": "Capability unknown",
|
||||
"AccountAlias_Status_Denied": "Send denied",
|
||||
"AccountCacheReset_Title": "Account Cache Reset",
|
||||
"AccountCacheReset_Message": "This account requires full re-sychronization to continue working. Please wait while Wino re-synchronizes your messages...",
|
||||
"AccountContactNameYou": "You",
|
||||
@@ -344,6 +349,7 @@
|
||||
"Exception_InvalidMultiAccountMoveTarget": "You can't move multiple items that belong to different accounts in linked account.",
|
||||
"Exception_MailProcessing": "This mail is still being processed. Please try again after few seconds.",
|
||||
"Exception_MissingAlias": "Primary alias does not exist for this account. Creating draft failed.",
|
||||
"Exception_AliasSendDenied_Message": "You do not have permission to send from alias {0}. Pick another alias or update your mailbox permissions.",
|
||||
"Exception_NullAssignedAccount": "Assigned account is null",
|
||||
"Exception_NullAssignedFolder": "Assigned folder is null",
|
||||
"Exception_SynchronizerFailureHTTP": "Response handling failed with error HTTP code {0}",
|
||||
|
||||
Reference in New Issue
Block a user