         }
     }
     
-    func showNotification(_ userInfo: [AnyHashable : Any]) -> Void {
+    func application(_ application: UIApplication,
+                     didReceive notification: UILocalNotification)
+    {
+        if let category = notification.category {
+            if category == "categoryLink" {
+                debugPrint("Tapped in notification with deep link")
+            }
+        }
+    }
+
+    func application(_ application: UIApplication,
+                     handleActionWithIdentifier identifier: String?,
+                     for notification: UILocalNotification,
+                     completionHandler: @escaping () -> Void)
+    {
+        if let category = notification.category {
+            if category == "categoryLink" {
+                if let action = identifier {
+                    if action == "actionLink" {
+                        debugPrint("Tapped in deep link")
+                        if let url:String = notification.userInfo?["deep_link"] as? String
+                        {
+                            debugPrint("Will resolve deep link")
+                            SCGPush.sharedInstance().resolveTrackedLink(url)
+                        }
+                    }
+                }
+            }
+        }
+    }
+    
+    func showSilentNotification(_ userInfo: [AnyHashable : Any],
+                                fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void ) {
         if #available(iOS 10.0, *) {
 
             let body: String = (userInfo["body"] as? String)!
             
             if let messageID = userInfo["scg-message-id"] as? String {
                 if let attachmentID = userInfo["scg-attachment-id"] as? String {
-                    showMediaNotification(body, messageID: messageID, attachmentID: attachmentID)
+                    showMediaNotification(body, messageID: messageID, attachmentID: attachmentID,
+                                          userInfo: userInfo,
+                                          fetchCompletionHandler: completionHandler)
                 } else {
-                    showTextNotification(withMessageId: messageID, andBody: body)
+                    showTextNotification(withMessageId: messageID, andBody: body, userInfo: userInfo)
+                    completionHandler(UIBackgroundFetchResult.noData)
                 }
             }
         } else {


@available(iOS 10.0, *)
extension AppDelegate: UNUserNotificationCenterDelegate {
    public func setUNUserNotificationCenterDelegate(_ center: UNUserNotificationCenter) {
        center.delegate = self
    }

                                                            debugPrint("failed to show notification with error: \(error?.localizedDescription ?? "Unknown")")
                                                        }
                                                    }
                                                    completionHandler(UIBackgroundFetchResult.newData)
                                                },
                                                failureBlock: { (error) in
                                                    debugPrint("loadAttachment \(attachmentID) failed with error: \(error?.localizedDescription ?? "Unknown")")
                                                    self.showTextNotification(withMessageId: messageID,  andBody: title, userInfo: userInfo)
                                                    completionHandler(UIBackgroundFetchResult.failed)
                                                })
    }
    
    @available( iOS 10.0, *)
    func showTextNotification(withMessageId messageId: String, andBody body: String, userInfo: [AnyHashable : Any]) {
        let content = UNMutableNotificationContent()
        content.body = body
        content.userInfo = userInfo
        
        if (userInfo["deep_link"] != nil) {
            content.categoryIdentifier = "categoryLink"
        }
        
        let request = UNNotificationRequest(identifier: messageId, content: content, trigger: nil)
        UNUserNotificationCenter.current().add(request) { error in
            if (error != nil){
