From 1e9b279a9b1b882b63b03584239b4be626987f8f Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sun, 21 Aug 2011 18:19:34 -0700 Subject: [PATCH] Removed basic notification. client side notification should be used. --- .../Model/Notification/BasicNotification.cs | 28 ----------- .../Notification/BasicNotificationType.cs | 9 ---- NzbDrone.Core/NzbDrone.Core.csproj | 3 -- .../Fakes/FakeNotificationProvider.cs | 49 ------------------- .../Providers/NotificationProvider.cs | 30 ------------ .../Controllers/NotificationController.cs | 31 ------------ 6 files changed, 150 deletions(-) delete mode 100644 NzbDrone.Core/Model/Notification/BasicNotification.cs delete mode 100644 NzbDrone.Core/Model/Notification/BasicNotificationType.cs delete mode 100644 NzbDrone.Core/Providers/Fakes/FakeNotificationProvider.cs diff --git a/NzbDrone.Core/Model/Notification/BasicNotification.cs b/NzbDrone.Core/Model/Notification/BasicNotification.cs deleted file mode 100644 index 225dc97a7..000000000 --- a/NzbDrone.Core/Model/Notification/BasicNotification.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; - -namespace NzbDrone.Core.Model.Notification -{ - public class BasicNotification - { - public BasicNotification() - { - Id = Guid.NewGuid(); - } - - /// - /// Gets or sets the unique id. - /// - /// The Id. - public Guid Id { get; private set; } - - public String Title { get; set; } - - public BasicNotificationType Type { get; set; } - - /// - /// Gets or sets a value indicating whether or not this message should be automatically dismissed after a period of time. - /// - /// true if [auto dismiss]; otherwise, false. - public bool AutoDismiss { get; set; } - } -} \ No newline at end of file diff --git a/NzbDrone.Core/Model/Notification/BasicNotificationType.cs b/NzbDrone.Core/Model/Notification/BasicNotificationType.cs deleted file mode 100644 index d06d37907..000000000 --- a/NzbDrone.Core/Model/Notification/BasicNotificationType.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace NzbDrone.Core.Model.Notification -{ - public enum BasicNotificationType - { - Info = 0, - Warrning = 1, - Error = 2 - } -} \ No newline at end of file diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index 20f03346f..ea66faf23 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -246,12 +246,9 @@ - - - diff --git a/NzbDrone.Core/Providers/Fakes/FakeNotificationProvider.cs b/NzbDrone.Core/Providers/Fakes/FakeNotificationProvider.cs deleted file mode 100644 index a6d6f6539..000000000 --- a/NzbDrone.Core/Providers/Fakes/FakeNotificationProvider.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using NzbDrone.Core.Model.Notification; - -namespace NzbDrone.Core.Providers.Fakes -{ - internal class FakeNotificationProvider - { - private readonly Dictionary _basicNotifications = - new Dictionary(); - - private readonly Object _lock = new object(); - - private readonly Dictionary _progressNotification = - new Dictionary(); - - - private readonly ProgressNotification fakeNotification = new ProgressNotification("Updating Series"); - private readonly ProgressNotification fakeNotification2 = new ProgressNotification("Updating Series2"); - - public List BasicNotifications - { - get { return new List(_basicNotifications.Values); } - } - - public List GetProgressNotifications - { - get - { - fakeNotification.Status = ProgressNotificationStatus.InProgress; - fakeNotification.Status = ProgressNotificationStatus.InProgress; - fakeNotification2.CurrentMessage = DateTime.UtcNow.ToString(); - fakeNotification.CurrentMessage = DateTime.Now.ToString(); - return new List { fakeNotification }; - } - } - - public void Register(ProgressNotification notification) - { - _progressNotification.Add(notification.Id, notification); - } - - public void Register(BasicNotification notification) - { - _basicNotifications.Add(notification.Id, notification); - } - - } -} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/NotificationProvider.cs b/NzbDrone.Core/Providers/NotificationProvider.cs index 85b32f22d..a76e7244f 100644 --- a/NzbDrone.Core/Providers/NotificationProvider.cs +++ b/NzbDrone.Core/Providers/NotificationProvider.cs @@ -7,19 +7,12 @@ namespace NzbDrone.Core.Providers { public class NotificationProvider { - private static readonly Dictionary _basicNotifications = - new Dictionary(); private static readonly Object _lock = new object(); private static readonly Dictionary _progressNotification = new Dictionary(); - public virtual List BasicNotifications - { - get { return new List(_basicNotifications.Values); } - } - public virtual List ProgressNotifications { get @@ -51,28 +44,5 @@ namespace NzbDrone.Core.Providers _progressNotification.Add(notification.Id, notification); } } - - public virtual void Register(BasicNotification notification) - { - lock (_lock) - { - _basicNotifications.Add(notification.Id, notification); - } - } - - public virtual void Dismiss(Guid notificationId) - { - lock (_lock) - { - if (_basicNotifications.ContainsKey(notificationId)) - { - _basicNotifications.Remove(notificationId); - } - else if (_progressNotification.ContainsKey(notificationId)) - { - _progressNotification.Remove(notificationId); - } - } - } } } \ No newline at end of file diff --git a/NzbDrone.Web/Controllers/NotificationController.cs b/NzbDrone.Web/Controllers/NotificationController.cs index 43a02b5c0..845687089 100644 --- a/NzbDrone.Web/Controllers/NotificationController.cs +++ b/NzbDrone.Web/Controllers/NotificationController.cs @@ -18,37 +18,6 @@ namespace NzbDrone.Web.Controllers _notifications = notificationProvider; } - [HttpGet] - public JsonResult Index() - { - string message = string.Empty; - - var basic = _notifications.BasicNotifications; - - if (basic.Count != 0) - { - message = basic[0].Title; - - if (basic[0].AutoDismiss) - _notifications.Dismiss(basic[0].Id); - } - - else - { - if (_notifications.ProgressNotifications.Count != 0) - message = _notifications.ProgressNotifications[0].CurrentMessage; - } - - - if (MiniProfiler.Current.DurationMilliseconds < 100) - { - MiniProfiler.Stop(true); - } - - return Json(message, JsonRequestBehavior.AllowGet); - } - - [HttpGet] public JsonResult Comet(string message) {