Skip to content

Commit

Permalink
Add Click URL support
Browse files Browse the repository at this point in the history
  • Loading branch information
binwiederhier committed May 25, 2022
1 parent 5b64f61 commit ec6472d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ntfy/App/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
let userInfo = response.notification.request.content.userInfo
Log.d(tag, "Notification received via userNotificationCenter(didReceive)", userInfo)

if let topic = userInfo["topic"] as? String {
selectedBaseUrl = topicUrl(baseUrl: Config.appBaseUrl, topic: topic)
let clickUrl = URL(string: userInfo["click"] as? String ?? "")
let topic = userInfo["topic"] as? String ?? ""
if let clickUrl = clickUrl {
UIApplication.shared.open(clickUrl, options: [:], completionHandler: nil)
} else if topic != "" {
selectedBaseUrl = topicUrl(baseUrl: Config.appBaseUrl, topic: topic)
}

completionHandler()
Expand Down

0 comments on commit ec6472d

Please sign in to comment.