I'm fairly new to programming and working on an app that will notify the users when my store is open. I'm using firebase to store data and i'm looking to use local notifications rather than push.
I have my app delegate set up according to some online sources to send notifications, but i'm not sure how to call a function for it. I'm using swift 4 in Xcode.
import Firebase
var refNotificationValue = DatabaseReference!
@IBAction func openButtonClicked(_ sender: UIButton) {
// Alert Controller confirming actions
self.shouldSendNotification()
}
// DidLoad()
refNotificationValue = database.database().reference().child("Notifications").child("enabled") // set to yes
// EndLoad()
func shouldSendNotification () {
refNotificationValue?.observeSingleEvent(of: .value, with: { (snapshot) in
let dict = snapshot.value as! [String: Any]
let status = dict["enabled"] as! String
if status == "yes" {
setToOpen()
sendNotification()
} else {
setToOpen()
}
})
}
func sendNotification() {
????????
}
Thanks so much in advance!!