mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 21:03:17 -07:00
Refactored the Notification service to how it should have really been done in the first place.
This commit is contained in:
parent
840deb6161
commit
3fe1f13bd1
17 changed files with 220 additions and 166 deletions
|
@ -96,6 +96,9 @@ namespace PlexRequests.UI
|
|||
container.Register<ISonarrApi, SonarrApi>();
|
||||
container.Register<IPlexApi, PlexApi>();
|
||||
|
||||
// NotificationService
|
||||
container.Register<INotificationService, NotificationService>().AsSingleton();
|
||||
|
||||
SubscribeAllObservers(container);
|
||||
base.ConfigureRequestContainer(container, context);
|
||||
}
|
||||
|
@ -130,25 +133,27 @@ namespace PlexRequests.UI
|
|||
|
||||
private void SubscribeAllObservers(TinyIoCContainer container)
|
||||
{
|
||||
var notificationService = container.Resolve<INotificationService>();
|
||||
|
||||
var emailSettingsService = container.Resolve<ISettingsService<EmailNotificationSettings>>();
|
||||
var emailSettings = emailSettingsService.GetSettings();
|
||||
if (emailSettings.Enabled)
|
||||
{
|
||||
NotificationService.Subscribe(new EmailMessageNotification(emailSettingsService));
|
||||
notificationService.Subscribe(new EmailMessageNotification(emailSettingsService));
|
||||
}
|
||||
|
||||
var pushbulletService = container.Resolve<ISettingsService<PushbulletNotificationSettings>>();
|
||||
var pushbulletSettings = pushbulletService.GetSettings();
|
||||
if (pushbulletSettings.Enabled)
|
||||
{
|
||||
NotificationService.Subscribe(new PushbulletNotification(container.Resolve<IPushbulletApi>(), pushbulletService));
|
||||
notificationService.Subscribe(new PushbulletNotification(container.Resolve<IPushbulletApi>(), pushbulletService));
|
||||
}
|
||||
|
||||
var pushoverService = container.Resolve<ISettingsService<PushoverNotificationSettings>>();
|
||||
var pushoverSettings = pushoverService.GetSettings();
|
||||
if (pushoverSettings.Enabled)
|
||||
{
|
||||
NotificationService.Subscribe(new PushoverNotification(container.Resolve<IPushoverApi>(), pushoverService));
|
||||
notificationService.Subscribe(new PushoverNotification(container.Resolve<IPushoverApi>(), pushoverService));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue