@@ -153,25 +153,33 @@ final class NotificationManager: NSObject, @unchecked Sendable {
153153 server. topics. contains { $0. name == message. topic }
154154 }
155155
156- // Determine click URL based on topic config
156+ // Determine click URL. Priority order:
157+ // 1. `click_url` from topic config (`false`, custom URL)
158+ // 2. `click` URL from the message itself
159+ // 3. Default server URL
157160 let clickUrl : String
161+ let isCustomClickUrl : Bool
162+
158163 switch topicConfig. clickUrl {
159- case . disabled:
160- clickUrl = " " // Empty string means disabled
161164 case . custom( let customUrl) :
165+ // 1. Highest priority: custom URL from config
162166 clickUrl = customUrl
163- case . enabled, . none:
164- // Default: use server url
165- clickUrl = serverConfig? . url ?? " "
166- }
167-
168- // Track if this is a custom URL (don't append topic) or server URL (append topic)
169- let isCustomClickUrl : Bool
170- switch topicConfig. clickUrl {
171- case . custom:
172167 isCustomClickUrl = true
173- default :
174- isCustomClickUrl = false
168+ case . disabled:
169+ // 1. Highest priority: disabled from config
170+ clickUrl = " "
171+ isCustomClickUrl = false // Not applicable
172+ case . enabled, . none:
173+ // Config doesn't specify an override, so check the message
174+ if let messageClickUrl = message. click, !messageClickUrl. isEmpty {
175+ // 2. Next priority: URL from the message
176+ clickUrl = messageClickUrl
177+ isCustomClickUrl = true
178+ } else {
179+ // 3. Fallback: default server URL
180+ clickUrl = serverConfig? . url ?? " "
181+ isCustomClickUrl = false
182+ }
175183 }
176184
177185 var userInfo : [ String : Any ] = [
0 commit comments