Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions LoopFollow/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,21 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void)
{
// Log the notification
let userInfo = notification.request.content.userInfo
let userInfoKeys = userInfo.keys.compactMap { $0 as? String }.sorted()
LogManager.shared.log(category: .general, message: "Will present notification: keys=\(userInfoKeys)")
let content = notification.request.content
let userInfoKeys = content.userInfo.keys.compactMap { $0 as? String }.sorted()
LogManager.shared.log(
category: .general,
message: "Will present notification: keys=\(userInfoKeys), interruption=\(content.interruptionLevel.rawValue), title=\(content.title.isEmpty ? "empty" : "set"), body=\(content.body.isEmpty ? "empty" : "set")"
)

// Suppress notifications iOS routes here that we never intended to surface:
// the Live Activity push-to-start uses interruption-level: passive with empty
// title/body and must not produce a banner or sound when LF is foregrounded.
if content.interruptionLevel == .passive || (content.title.isEmpty && content.body.isEmpty) {
completionHandler([])
return
}

// Show the notification even when app is in foreground
completionHandler([.banner, .sound, .badge])
}
}
Loading