Files
Wino-Mail/Wino.Core/CoreContainerSetup.cs
T

67 lines
3.1 KiB
C#
Raw Normal View History

2024-04-18 01:44:37 +02:00
using Microsoft.Extensions.DependencyInjection;
using Serilog.Core;
using Wino.Authentication;
2024-04-18 01:44:37 +02:00
using Wino.Core.Domain.Interfaces;
using Wino.Core.Integration.Processors;
using Wino.Core.Services;
2026-02-08 22:20:38 +01:00
using Wino.Core.Synchronizers.Errors;
using Wino.Core.Synchronizers.Errors.Gmail;
using Wino.Core.Synchronizers.Errors.Imap;
using Wino.Core.Synchronizers.Errors.Outlook;
2025-02-15 12:53:32 +01:00
using Wino.Core.Synchronizers.ImapSync;
2024-04-18 01:44:37 +02:00
2025-02-16 11:54:23 +01:00
namespace Wino.Core;
public static class CoreContainerSetup
2024-04-18 01:44:37 +02:00
{
2025-02-16 11:54:23 +01:00
public static void RegisterCoreServices(this IServiceCollection services)
2024-04-18 01:44:37 +02:00
{
2025-02-16 11:54:23 +01:00
var loggerLevelSwitcher = new LoggingLevelSwitch();
2024-04-18 01:44:37 +02:00
2025-02-16 11:54:23 +01:00
services.AddSingleton(loggerLevelSwitcher);
services.AddSingleton<ISynchronizerFactory, SynchronizerFactory>();
2025-10-04 23:10:07 +02:00
services.AddSingleton<ISynchronizationManager>(provider => SynchronizationManager.Instance);
services.AddTransient<SynchronizationManagerInitializer>();
2024-04-18 01:44:37 +02:00
2025-02-16 11:54:23 +01:00
services.AddTransient<IGmailChangeProcessor, GmailChangeProcessor>();
services.AddTransient<IImapChangeProcessor, ImapChangeProcessor>();
services.AddTransient<IOutlookChangeProcessor, OutlookChangeProcessor>();
services.AddTransient<IWinoRequestProcessor, WinoRequestProcessor>();
services.AddTransient<IWinoRequestDelegator, WinoRequestDelegator>();
services.AddTransient<IImapTestService, ImapTestService>();
services.AddTransient<IAuthenticationProvider, AuthenticationProvider>();
services.AddTransient<IAutoDiscoveryService, AutoDiscoveryService>();
services.AddTransient<IFontService, FontService>();
services.AddTransient<IUnsubscriptionService, UnsubscriptionService>();
services.AddTransient<IOutlookAuthenticator, OutlookAuthenticator>();
services.AddTransient<IGmailAuthenticator, GmailAuthenticator>();
2025-02-15 12:53:32 +01:00
services.AddTransient<UnifiedImapSynchronizer>();
// Register Outlook error handlers
services.AddTransient<ObjectCannotBeDeletedHandler>();
2025-10-12 16:23:33 +02:00
services.AddTransient<DeltaTokenExpiredHandler>();
// Register Gmail error handlers
services.AddTransient<GmailQuotaExceededHandler>();
services.AddTransient<GmailRateLimitHandler>();
services.AddTransient<GmailHistoryExpiredHandler>();
2026-02-08 22:20:38 +01:00
// Register shared error handlers
services.AddTransient<EntityNotFoundHandler>();
// Register IMAP error handlers
services.AddTransient<ImapConnectionLostHandler>();
services.AddTransient<ImapAuthenticationFailedHandler>();
services.AddTransient<ImapFolderNotFoundHandler>();
services.AddTransient<ImapProtocolErrorHandler>();
// Register error handler factories
services.AddTransient<IOutlookSynchronizerErrorHandlerFactory, OutlookSynchronizerErrorHandlingFactory>();
services.AddTransient<IGmailSynchronizerErrorHandlerFactory, GmailSynchronizerErrorHandlingFactory>();
services.AddTransient<IImapSynchronizerErrorHandlerFactory, ImapSynchronizerErrorHandlingFactory>();
// Register retry executor
services.AddTransient<IRetryExecutor, RetryExecutor>();
2024-04-18 01:44:37 +02:00
}
}