@@ -23,34 +23,6 @@ final class NotificationManager: NSObject, ObservableObject {
23
23
24
24
private var isAppActive : Bool = true
25
25
26
- /// Whether notifications were manually shown via toolbar
27
- @Published private( set) var isManuallyShown : Bool = false
28
-
29
- /// Set of hidden notification IDs
30
- private var hiddenNotificationIds : Set < UUID > = [ ]
31
-
32
- /// Whether any non-sticky notifications are currently hidden
33
- private var hasHiddenNotifications : Bool {
34
- activeNotifications. contains { notification in
35
- !notification. isSticky && !isNotificationVisible( notification)
36
- }
37
- }
38
-
39
- /// Whether a notification should be visible in the overlay
40
- func isNotificationVisible( _ notification: CENotification ) -> Bool {
41
- if notification. isBeingDismissed {
42
- return true // Always show notifications being dismissed
43
- }
44
- if notification. isSticky {
45
- return true // Always show sticky notifications
46
- }
47
- if isManuallyShown {
48
- return true // Show all notifications when manually shown
49
- }
50
- // Otherwise, show if not hidden and has active timer
51
- return !hiddenNotificationIds. contains ( notification. id) && timers [ notification. id] != nil
52
- }
53
-
54
26
/// Number of unread notifications
55
27
var unreadCount : Int {
56
28
notifications. filter { !$0. isRead } . count
@@ -172,64 +144,6 @@ final class NotificationManager: NSObject, ObservableObject {
172
144
}
173
145
}
174
146
175
- /// Updates an existing notification
176
- /// - Parameters:
177
- /// - id: UUID of notification to update
178
- /// - title: New title (optional)
179
- /// - description: New description (optional)
180
- /// - actionButtonTitle: New action button title (optional)
181
- /// - action: New action closure (optional)
182
- /// - isSticky: New sticky state (optional)
183
- func update(
184
- id: UUID ,
185
- title: String ? = nil ,
186
- description: String ? = nil ,
187
- actionButtonTitle: String ? = nil ,
188
- action: ( ( ) -> Void ) ? = nil ,
189
- isSticky: Bool ? = nil
190
- ) {
191
- if let index = notifications. firstIndex ( where: { $0. id == id } ) {
192
- var notification = notifications [ index]
193
-
194
- if let title = title {
195
- notification. title = title
196
- }
197
- if let description = description {
198
- notification. description = description
199
- }
200
- if let actionButtonTitle = actionButtonTitle {
201
- notification. actionButtonTitle = actionButtonTitle
202
- }
203
- if let action = action {
204
- notification. action = action
205
- }
206
- if let isSticky = isSticky {
207
- notification. isSticky = isSticky
208
- }
209
-
210
- notifications [ index] = notification
211
- }
212
- }
213
-
214
- /// Deletes a notification
215
- /// - Parameter id: UUID of notification to delete
216
- func delete( id: UUID ) {
217
- if let notification = notifications. first ( where: { $0. id == id } ) {
218
- dismissNotification ( notification)
219
- }
220
- }
221
-
222
- /// Deletes a notification after a delay
223
- /// - Parameters:
224
- /// - id: UUID of notification to delete
225
- /// - delay: Time to wait before deleting
226
- func delete( id: UUID , delay: TimeInterval ) {
227
- Task { @MainActor in
228
- try ? await Task . sleep ( for: . seconds( delay) )
229
- delete ( id: id)
230
- }
231
- }
232
-
233
147
override init ( ) {
234
148
super. init ( )
235
149
setupNotificationDelegate ( )
0 commit comments