Browse Source

Start refactoring notifications.

Jon Shier 7 years ago
parent
commit
c409e7a1f3
1 changed files with 12 additions and 15 deletions
  1. 12 15
      Source/Notifications.swift

+ 12 - 15
Source/Notifications.swift

@@ -24,20 +24,20 @@
 
 import Foundation
 
-extension Notification.Name {
-    /// Used as a namespace for all `URLSessionTask` related notifications.
-    public struct Task {
-        /// Posted when a `URLSessionTask` is resumed. The notification `object` contains the resumed `URLSessionTask`.
-        public static let DidResume = Notification.Name(rawValue: "org.alamofire.notification.name.task.didResume")
+extension Notification.Name {    
+    /// Used as a namespace for all Alamofire related notifications.
+    public struct Alamofire {
+        /// Posted when a `Request` is resumed. The notification `object` contains the resumed `Request`.
+        public static let didResume = Notification.Name(rawValue: "org.alamofire.notification.name.request.didResume")
 
-        /// Posted when a `URLSessionTask` is suspended. The notification `object` contains the suspended `URLSessionTask`.
-        public static let DidSuspend = Notification.Name(rawValue: "org.alamofire.notification.name.task.didSuspend")
+        /// Posted when a `Request` is suspended. The notification `object` contains the suspended `Request`.
+        public static let didSuspend = Notification.Name(rawValue: "org.alamofire.notification.name.request.didSuspend")
 
-        /// Posted when a `URLSessionTask` is cancelled. The notification `object` contains the cancelled `URLSessionTask`.
-        public static let DidCancel = Notification.Name(rawValue: "org.alamofire.notification.name.task.didCancel")
+        /// Posted when a `Request` is cancelled. The notification `object` contains the cancelled `Request`.
+        public static let didCancel = Notification.Name(rawValue: "org.alamofire.notification.name.request.didCancel")
 
-        /// Posted when a `URLSessionTask` is completed. The notification `object` contains the completed `URLSessionTask`.
-        public static let DidComplete = Notification.Name(rawValue: "org.alamofire.notification.name.task.didComplete")
+        /// Posted when a `Request` is completed. The notification `object` contains the completed `Request`.
+        public static let didComplete = Notification.Name(rawValue: "org.alamofire.notification.name.request.didComplete")
     }
 }
 
@@ -47,9 +47,6 @@ extension Notification {
     /// Used as a namespace for all `Notification` user info dictionary keys.
     public struct Key {
         /// User info dictionary key representing the `URLSessionTask` associated with the notification.
-        public static let Task = "org.alamofire.notification.key.task"
-
-        /// User info dictionary key representing the responseData associated with the notification.
-        public static let ResponseData = "org.alamofire.notification.key.responseData"
+        public static let request = "org.alamofire.notification.key.request"
     }
 }