2013-10-12 18:44:40 +00:00
|
|
|
|
using System.Collections.Generic;
|
2013-10-13 02:46:36 +00:00
|
|
|
|
using System.Linq;
|
2013-10-12 18:44:40 +00:00
|
|
|
|
using NLog;
|
2013-10-13 02:46:36 +00:00
|
|
|
|
using NzbDrone.Common.Composition;
|
2014-02-26 05:40:47 +00:00
|
|
|
|
using NzbDrone.Core.Messaging.Events;
|
2013-10-12 18:44:40 +00:00
|
|
|
|
using NzbDrone.Core.ThingiProvider;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Notifications
|
|
|
|
|
{
|
|
|
|
|
public interface INotificationFactory : IProviderFactory<INotification, NotificationDefinition>
|
|
|
|
|
{
|
2013-10-13 02:46:36 +00:00
|
|
|
|
List<INotification> OnGrabEnabled();
|
|
|
|
|
List<INotification> OnDownloadEnabled();
|
2014-02-11 01:09:31 +00:00
|
|
|
|
List<INotification> OnUpgradeEnabled();
|
2013-10-12 18:44:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class NotificationFactory : ProviderFactory<INotification, NotificationDefinition>, INotificationFactory
|
|
|
|
|
{
|
2014-02-26 05:40:47 +00:00
|
|
|
|
public NotificationFactory(INotificationRepository providerRepository, IEnumerable<INotification> providers, IContainer container, IEventAggregator eventAggregator, Logger logger)
|
|
|
|
|
: base(providerRepository, providers, container, eventAggregator, logger)
|
2013-10-12 18:44:40 +00:00
|
|
|
|
{
|
2013-10-13 02:46:36 +00:00
|
|
|
|
}
|
2013-10-12 18:44:40 +00:00
|
|
|
|
|
2013-10-13 02:46:36 +00:00
|
|
|
|
public List<INotification> OnGrabEnabled()
|
|
|
|
|
{
|
|
|
|
|
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnGrab).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<INotification> OnDownloadEnabled()
|
|
|
|
|
{
|
|
|
|
|
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnDownload).ToList();
|
2013-10-12 18:44:40 +00:00
|
|
|
|
}
|
2014-02-11 01:09:31 +00:00
|
|
|
|
|
|
|
|
|
public List<INotification> OnUpgradeEnabled()
|
|
|
|
|
{
|
|
|
|
|
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnUpgrade).ToList();
|
|
|
|
|
}
|
2013-10-12 18:44:40 +00:00
|
|
|
|
}
|
|
|
|
|
}
|