                     
                     if sn != nil && sn! == true {
                         debugPrint("showing notification")
-                        showNotification(userInfo)
+
+                        if (UserDefaults.standard.bool(forKey: "reporton")) {
+                            if let messageID:String = userInfo["scg-message-id"] as? String
+                            {
+                                SCGPush.sharedInstance().reportStatus(withMessageId: messageID, andMessageState: MessageState.delivered, completionBlock: {
+                                    debugPrint("Successfully reportStatus  withMessageId: \(messageID)")
+                                }, failureBlock: { (error) in
+                                    debugPrint("Error reportStatus  withMessageId: \(messageID), error: \((error?.localizedDescription)!)")
+                                })
+                            }
+                        }
+
+                        showSilentNotification(userInfo, fetchCompletionHandler: completionHandler)
+                        
                     } else {
                         debugPrint("pushing to inbox")
                         SCGPush.sharedInstance().push(toInbox: userInfo)
+
+                        if (UserDefaults.standard.bool(forKey: "reporton")) {
+                            if let messageID:String = userInfo["scg-message-id"] as? String
+                            {
+                                SCGPush.sharedInstance().reportStatus(withMessageId: messageID, andMessageState: MessageState.delivered, completionBlock: {
+                                    debugPrint("Successfully reportStatus  withMessageId: \(messageID)")
+                                    completionHandler(UIBackgroundFetchResult.newData)
+                                }, failureBlock: { (error) in
+                                    debugPrint("Error reportStatus  withMessageId: \(messageID), error: \((error?.localizedDescription)!)")
+                                    completionHandler(UIBackgroundFetchResult.failed)
+                                })
+                            } else {
+                                completionHandler(UIBackgroundFetchResult.newData)
+                            }
+                        } else {
+                            completionHandler(UIBackgroundFetchResult.newData)
+                        }
                     }
-                    
-                    completionHandler(UIBackgroundFetchResult.newData)
-                    return
-                }
-            }
-            else {
-            
+                }
+            } else {
                 if let url:String = userInfo["deep_link"] as? String
                 {
                     SCGPush.sharedInstance().resolveTrackedLink(url)

    }
    
    public func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Swift.Void) {
        debugPrint("Tapped in notification")
        completionHandler()
    }
}

                                                            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){
