                     message.from = value?["from"] as! String
                     message.uuid = value?["uuid"] as! String
                     message.getAt = value?["getAt"] as! String
+                    
+                    // fire notifications when message is waiting
+                    if self.isGrantedNotificationAccess {
+                        let content = UNMutableNotificationContent()
+                        content.title = "Latr"
+                        content.body = "You have a message waiting!"
+                        let unitFlags:Set<Calendar.Component> = [.minute,.hour,.second]
+                        var date = Calendar.current.dateComponents(unitFlags, from: Date())
+                        date.second = date.second! + 5
+                        
+                        
+                        
+                        let trigger = UNCalendarNotificationTrigger(dateMatching: date, repeats: false)
+                        self.addNotifications(trigger: trigger, content: content, identifier: "message.scheduled")
+                    }
+
+                    
                 }
 
 
-
-
-
             // take in the message's show critera
-//            message.displayable = value?["displayable"] as! String
+            // message.displayable = value?["displayable"] as! String
 
             // that message's unique id
             message.key = snapshot.key

    var isGrantedNotificationAccess = false

    
    
    
    
    
    
    
    

    @IBOutlet weak var tableView: UITableView!

    @IBAction func tappedLogout(_ sender: Any) {
        dismiss(animated: true, completion: nil)
    }
    
    //MARK: - Delegates in-app notifications
    
    @available(iOS 10.0, *)
    func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
        completionHandler([.alert, .sound]) //presentation options as arguments
    }
    
    


}
