Notifications.swift (3149B)
1 // 2 // Notifications.swift 3 // damus 4 // 5 // Created by William Casarin on 2022-04-22. 6 // 7 8 import Foundation 9 10 extension Notification.Name { 11 static var thread_focus: Notification.Name { 12 return Notification.Name("thread focus") 13 } 14 } 15 16 extension Notification.Name { 17 static var select_event: Notification.Name { 18 return Notification.Name("select_event") 19 } 20 } 21 22 extension Notification.Name { 23 static var select_quote: Notification.Name { 24 return Notification.Name("select quote") 25 } 26 } 27 28 extension Notification.Name { 29 static var reply: Notification.Name { 30 return Notification.Name("reply") 31 } 32 } 33 34 extension Notification.Name { 35 static var profile_updated: Notification.Name { 36 return Notification.Name("profile_updated") 37 } 38 } 39 40 extension Notification.Name { 41 static var switched_timeline: Notification.Name { 42 return Notification.Name("switched_timeline") 43 } 44 } 45 46 extension Notification.Name { 47 static var liked: Notification.Name { 48 return Notification.Name("liked") 49 } 50 } 51 52 extension Notification.Name { 53 static var open_profile: Notification.Name { 54 return Notification.Name("open_profile") 55 } 56 } 57 58 extension Notification.Name { 59 static var scroll_to_top: Notification.Name { 60 return Notification.Name("scroll_to_to") 61 } 62 } 63 64 extension Notification.Name { 65 static var broadcast_event: Notification.Name { 66 return Notification.Name("broadcast event") 67 } 68 } 69 70 extension Notification.Name { 71 static var open_thread: Notification.Name { 72 return Notification.Name("open thread") 73 } 74 } 75 76 extension Notification.Name { 77 static var notice: Notification.Name { 78 return Notification.Name("notice") 79 } 80 } 81 82 extension Notification.Name { 83 static var like: Notification.Name { 84 return Notification.Name("like note") 85 } 86 } 87 88 extension Notification.Name { 89 static var delete: Notification.Name { 90 return Notification.Name("delete note") 91 } 92 } 93 94 extension Notification.Name { 95 static var post: Notification.Name { 96 return Notification.Name("send post") 97 } 98 } 99 100 extension Notification.Name { 101 static var boost: Notification.Name { 102 return Notification.Name("boost") 103 } 104 } 105 106 extension Notification.Name { 107 static var boosted: Notification.Name { 108 return Notification.Name("boosted") 109 } 110 } 111 112 extension Notification.Name { 113 static var follow: Notification.Name { 114 return Notification.Name("follow") 115 } 116 } 117 118 extension Notification.Name { 119 static var unfollow: Notification.Name { 120 return Notification.Name("unfollow") 121 } 122 } 123 124 extension Notification.Name { 125 static var followed: Notification.Name { 126 return Notification.Name("followed") 127 } 128 } 129 130 extension Notification.Name { 131 static var unfollowed: Notification.Name { 132 return Notification.Name("unfollowed") 133 } 134 } 135 136 func handle_notify(_ name: Notification.Name) -> NotificationCenter.Publisher { 137 return NotificationCenter.default.publisher(for: name) 138 } 139 140 func notify(_ name: NSNotification.Name, _ object: Any?) { 141 NotificationCenter.default.post(name: name, object: object) 142 }