Editing an alarm now reschedules the notification

This commit is contained in:
Aaron
2021-01-26 22:18:18 -05:00
parent 53a3616d5c
commit e55736d4d5
2 changed files with 21 additions and 5 deletions
+12
View File
@@ -16,6 +16,18 @@ class Notification {
var alarm: Alarm
func removeNotification() {
UNUserNotificationCenter.current().getPendingNotificationRequests { (notificationRequests) in
var identifiers: [String] = []
for notification:UNNotificationRequest in notificationRequests {
if notification.identifier == self.alarm.notificationID {
identifiers.append(notification.identifier)
}
}
UNUserNotificationCenter.current().removePendingNotificationRequests(withIdentifiers: identifiers)
}
}
func scheduleNotification() {
let content = UNMutableNotificationContent()