Skip to content

Commit 080243a

Browse files
committed
Remove Store.save calls
1 parent de92923 commit 080243a

File tree

3 files changed

+2
-26
lines changed

3 files changed

+2
-26
lines changed

ntfy/App/AppDelegate.swift

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -97,23 +97,6 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
9797
) {
9898
let userInfo = notification.request.content.userInfo
9999
Log.d(tag, "Notification received via userNotificationCenter(willPresent)", userInfo)
100-
101-
guard let message = Message.from(userInfo: userInfo) else {
102-
Log.w(tag, "Cannot convert userInfo to message", userInfo)
103-
completionHandler([])
104-
return
105-
}
106-
107-
let store = Store.shared
108-
let baseUrl = userInfo["base_url"] as? String ?? Config.appBaseUrl
109-
110-
guard let subscription = store.getSubscription(baseUrl: baseUrl, topic: message.topic) else {
111-
Log.w(tag, "Subscription \(topicUrl(baseUrl: baseUrl, topic: message.topic)) unknown")
112-
completionHandler([])
113-
return
114-
}
115-
Store.shared.save(notificationFromMessage: message, withSubscription: subscription)
116-
117100
completionHandler([[.banner, .sound]])
118101
}
119102

@@ -131,17 +114,9 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
131114
return
132115
}
133116

134-
let store = Store.shared
135117
let baseUrl = userInfo["base_url"] as? String ?? Config.appBaseUrl
136118
let action = message.actions?.first { $0.id == response.actionIdentifier }
137119

138-
guard let subscription = store.getSubscription(baseUrl: baseUrl, topic: message.topic) else {
139-
Log.w(tag, "Subscription \(topicUrl(baseUrl: baseUrl, topic: message.topic)) unknown")
140-
completionHandler()
141-
return
142-
}
143-
Store.shared.save(notificationFromMessage: message, withSubscription: subscription)
144-
145120
// Show current topic
146121
if message.topic != "" {
147122
selectedBaseUrl = topicUrl(baseUrl: baseUrl, topic: message.topic)

ntfy/Persistence/NotificationsObservable.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class NotificationsObservable: NSObject, ObservableObject {
2626
super.init()
2727

2828
do {
29+
Log.d(tag, "Fetching notifications")
2930
try self.fetchedResultsController.performFetch()
3031
self.notifications = self.fetchedResultsController.fetchedObjects ?? []
3132
} catch {

ntfy/Persistence/SubscriptionsObservable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class SubscriptionsObservable: NSObject, ObservableObject {
2222
Log.d(tag, "Fetching subscriptions")
2323
try controller.performFetch()
2424
} catch {
25-
Log.w(tag, "Failed to fetch items: \(error)", error)
25+
Log.w(tag, "Failed to fetch subscriptions: \(error)", error)
2626
}
2727

2828
return controller

0 commit comments

Comments
 (0)