From 18d60abed1ee16ef5b0c4d477c751e18c18761ea Mon Sep 17 00:00:00 2001 From: artem-dudarev Date: Fri, 2 Aug 2024 12:46:35 +0200 Subject: [PATCH] Remove obsolete IEmailSender --- .../Senders/EmailNotificationMessageSender.cs | 41 ------------------- .../Module.cs | 4 -- 2 files changed, 45 deletions(-) delete mode 100644 src/VirtoCommerce.NotificationsModule.Data/Senders/EmailNotificationMessageSender.cs diff --git a/src/VirtoCommerce.NotificationsModule.Data/Senders/EmailNotificationMessageSender.cs b/src/VirtoCommerce.NotificationsModule.Data/Senders/EmailNotificationMessageSender.cs deleted file mode 100644 index cb8815c..0000000 --- a/src/VirtoCommerce.NotificationsModule.Data/Senders/EmailNotificationMessageSender.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Threading.Tasks; -using Microsoft.Extensions.Options; -using VirtoCommerce.NotificationsModule.Core.Model; -using VirtoCommerce.NotificationsModule.Core.Services; -using VirtoCommerce.Platform.Core.Common; -using VirtoCommerce.Platform.Core.Notifications; - -namespace VirtoCommerce.NotificationsModule.Data.Senders -{ - [Obsolete("Use notification feature instead")] - public class EmailNotificationMessageSender : IEmailSender - { - private readonly INotificationMessageSenderFactory _notificationMessageSenderProviderFactory; - private readonly EmailSendingOptions _emailSendingOptions; - - public EmailNotificationMessageSender( - INotificationMessageSenderFactory notificationMessageSenderProviderFactory - , IOptions emailSendingOptions) - { - _notificationMessageSenderProviderFactory = notificationMessageSenderProviderFactory; - _emailSendingOptions = emailSendingOptions.Value; - } - - public async Task SendEmailAsync(string email, string subject, string body) - { - var message = AbstractTypeFactory.TryCreateInstance(nameof(EmailNotificationMessage)); - if (message is EmailNotificationMessage notificationMessage) - { - notificationMessage.From = _emailSendingOptions.DefaultSender; - notificationMessage.To = email; - notificationMessage.Subject = subject; - notificationMessage.Body = body; - } - - await _notificationMessageSenderProviderFactory.GetSender(message).SendNotificationAsync(message); - } - - - } -} diff --git a/src/VirtoCommerce.NotificationsModule.Web/Module.cs b/src/VirtoCommerce.NotificationsModule.Web/Module.cs index 813eae3..828c6b9 100644 --- a/src/VirtoCommerce.NotificationsModule.Web/Module.cs +++ b/src/VirtoCommerce.NotificationsModule.Web/Module.cs @@ -32,7 +32,6 @@ using VirtoCommerce.Platform.Core.ExportImport; using VirtoCommerce.Platform.Core.JsonConverters; using VirtoCommerce.Platform.Core.Modularity; -using VirtoCommerce.Platform.Core.Notifications; using VirtoCommerce.Platform.Core.Security; using VirtoCommerce.Platform.Core.Security.Events; using VirtoCommerce.Platform.Core.Settings; @@ -76,9 +75,6 @@ public void Initialize(IServiceCollection serviceCollection) serviceCollection.AddTransient(); serviceCollection.AddTransient(); serviceCollection.AddTransient(); -#pragma warning disable CS0618 // Type or member is obsolete - serviceCollection.AddTransient(); -#pragma warning restore CS0618 // Type or member is obsolete serviceCollection.AddTransient(); serviceCollection.AddTransient();