Skip to content
This repository was archived by the owner on Jan 19, 2026. It is now read-only.

Commit 99186fa

Browse files
committed
Fix downloading notification settings
1 parent d35c620 commit 99186fa

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

macOS/Features/MessageDetail/AttachmentsViewController.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,10 @@ final class AttachmentsViewController: ObservableObject {
9090
content.categoryIdentifier = "openFileFromLocation"
9191
content.userInfo = ["location": savedLocation.absoluteString]
9292

93-
let openAction = UNNotificationAction(identifier: "Open", title: "Open", options: [.foreground, .authenticationRequired])
93+
let openAction = UNNotificationAction(identifier: "Open", title: "Open", options: .foreground)
9494
let category = UNNotificationCategory(identifier: "Attachment",
9595
actions: [openAction],
96-
intentIdentifiers: [],
97-
options: [.hiddenPreviewsShowSubtitle])
96+
intentIdentifiers: [])
9897

9998
let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: nil)
10099
center.setNotificationCategories([category])

macOS/Features/MessageDetail/MessageDetailViewController.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,10 @@ class MessageDetailViewController: ObservableObject {
119119
content.categoryIdentifier = "openFileFromLocation"
120120
content.userInfo = ["location": savedLocation.absoluteString]
121121

122-
let openAction = UNNotificationAction(identifier: "Open", title: "Open", options: [.foreground, .authenticationRequired])
122+
let openAction = UNNotificationAction(identifier: "Open", title: "Open", options: .foreground)
123123
let category = UNNotificationCategory(identifier: "Message",
124124
actions: [openAction],
125-
intentIdentifiers: [],
126-
options: [.hiddenPreviewsShowSubtitle])
125+
intentIdentifiers: [])
127126

128127
let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: nil)
129128
center.setNotificationCategories([category])

macOS/RootNavigationView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ struct RootNavigationView: View {
2626
Text("No Message Selected")
2727
.font(.largeTitle)
2828
.opacity(0.4)
29+
.frame(minWidth: 500)
2930
}
3031

3132
}

macOS/TempBoxApp.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent
3636

3737
func registerNotifications() {
3838
UNUserNotificationCenter.current().requestAuthorization(
39-
options: [.alert, .sound]
39+
options: [.alert, .sound, .badge]
4040
) { accepted, error in
41-
print(accepted, error)
41+
if let error = error {
42+
print(error)
43+
return
44+
}
4245
Defaults[.isNotificationsEnabled] = accepted
4346
if !accepted {
4447
print("Notification access denied.")
@@ -70,7 +73,9 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent
7073
let userInfo = response.notification.request.content.userInfo
7174

7275
if let fileLocation = userInfo["location"] as? String, let fileUrl = URL(string: fileLocation) {
73-
NSWorkspace.shared.open(fileUrl)
76+
if response.actionIdentifier == "Open" {
77+
NSWorkspace.shared.open(fileUrl)
78+
}
7479
}
7580
}
7681
completionHandler()

0 commit comments

Comments
 (0)