Added support for one click unsubscribe with confirmation dialog.

This commit is contained in:
Aleh Khantsevich
2024-05-01 14:23:23 +02:00
parent 2bcb6a146b
commit e2f0c73bab
5 changed files with 118 additions and 22 deletions

View File

@@ -11,10 +11,9 @@ namespace Wino.Core.Domain.Models.Reader
{
public string RenderHtml { get; }
public MailRenderingOptions MailRenderingOptions { get; }
public List<MimePart> Attachments { get; set; } = new List<MimePart>();
public List<MimePart> Attachments { get; set; } = [];
public string UnsubscribeLink { get; set; }
public bool CanUnsubscribe => !string.IsNullOrEmpty(UnsubscribeLink);
public UnsubscribeInfo UnsubscribeInfo { get; set; }
public MailRenderModel(string renderHtml, MailRenderingOptions mailRenderingOptions = null)
{
@@ -22,4 +21,12 @@ namespace Wino.Core.Domain.Models.Reader
MailRenderingOptions = mailRenderingOptions;
}
}
public class UnsubscribeInfo
{
public string HttpLink { get; set; }
public string MailToLink { get; set; }
public bool IsOneClick { get; set; }
public bool CanUnsubscribe => HttpLink != null || MailToLink != null;
}
}

View File

@@ -76,6 +76,11 @@
"DialogMessage_UnlinkAccountsConfirmationTitle": "Unlink Accounts",
"DialogMessage_EmptySubjectConfirmation": "Missin Subject",
"DialogMessage_EmptySubjectConfirmationMessage": "Message has no subject. Do you want to continue?",
"DialogMessage_UnsubscribeConfirmationTitle": "Unsubscribe",
"DialogMessage_UnsubscribeConfirmationOneClickMessage": "Do you want to stop getting messages from {0}?",
"DialogMessage_UnsubscribeConfirmationGoToWebsiteMessage": "To stop getting messages from {0}, go to their website to unsubscribe.",
"DialogMessage_UnsubscribeConfirmationGoToWebsiteConfirmButton": "Go to website",
"DialogMessage_UnsubscribeConfirmationMailtoMessage": "Do you want to stop getting messages from {0}? WinoMail will unsubscribe for you by sending an email from your email account to {1}.",
"Dialog_DontAskAgain": "Don't ask again",
"DiscordChannelDisclaimerMessage": "Wino doesn't have it's own Discord server, but special 'wino-mail' channel is hosted at 'Developer Sanctuary' server.\nTo get the updates about Wino please join Developer Sanctuary server and follow 'wino-mail' channel under 'Community Projects'\n\nYou will be directed to server URL since Discord doesn't support channel invites.",
"DiscordChannelDisclaimerTitle": "Important Discord Information",
@@ -230,6 +235,8 @@
"Info_UnsupportedFunctionalityTitle": "Unsupported",
"Info_UnsubscribeLinkInvalidTitle": "Invalid Unsubscribe Uri",
"Info_UnsubscribeLinkInvalidMessage": "This unsubscribe link is invalid. Failed to unsubscribe from the list.",
"Info_UnsubscribeSuccessMessage": "Successfully unsubscribed from {0}.",
"Info_UnsubscribeErrorMessage": "Failed to unsubscribe",
"ImapAdvancedSetupDialog_AuthenticationMethod": "Authentication method",
"ImapAdvancedSetupDialog_ConnectionSecurity": "Connection security",
"ImapAuthenticationMethod_Auto": "Auto",

View File

@@ -403,6 +403,31 @@ namespace Wino.Core.Domain
/// </summary>
public static string DialogMessage_EmptySubjectConfirmationMessage => Resources.GetTranslatedString(@"DialogMessage_EmptySubjectConfirmationMessage");
/// <summary>
/// Unsubscribe
/// </summary>
public static string DialogMessage_UnsubscribeConfirmationTitle => Resources.GetTranslatedString(@"DialogMessage_UnsubscribeConfirmationTitle");
/// <summary>
/// Do you want to stop getting messages from {0}?
/// </summary>
public static string DialogMessage_UnsubscribeConfirmationOneClickMessage => Resources.GetTranslatedString(@"DialogMessage_UnsubscribeConfirmationOneClickMessage");
/// <summary>
/// To stop getting messages from {0}, go to their website to unsubscribe.
/// </summary>
public static string DialogMessage_UnsubscribeConfirmationGoToWebsiteMessage => Resources.GetTranslatedString(@"DialogMessage_UnsubscribeConfirmationGoToWebsiteMessage");
/// <summary>
/// Go to website
/// </summary>
public static string DialogMessage_UnsubscribeConfirmationGoToWebsiteConfirmButton => Resources.GetTranslatedString(@"DialogMessage_UnsubscribeConfirmationGoToWebsiteConfirmButton");
/// <summary>
/// Do you want to stop getting messages from {0}? WinoMail will unsubscribe for you by sending an email from your email account to {1}.
/// </summary>
public static string DialogMessage_UnsubscribeConfirmationMailtoMessage => Resources.GetTranslatedString(@"DialogMessage_UnsubscribeConfirmationMailtoMessage");
/// <summary>
/// Don't ask again
/// </summary>
@@ -1173,6 +1198,16 @@ namespace Wino.Core.Domain
/// </summary>
public static string Info_UnsubscribeLinkInvalidMessage => Resources.GetTranslatedString(@"Info_UnsubscribeLinkInvalidMessage");
/// <summary>
/// Successfully unsubscribed from {0}.
/// </summary>
public static string Info_UnsubscribeSuccessMessage => Resources.GetTranslatedString(@"Info_UnsubscribeSuccessMessage");
/// <summary>
/// Failed to unsubscribe
/// </summary>
public static string Info_UnsubscribeErrorMessage => Resources.GetTranslatedString(@"Info_UnsubscribeErrorMessage");
/// <summary>
/// Authentication method
/// </summary>