Added NotificationID property to Alarm

This commit is contained in:
Aaron
2021-01-25 09:38:00 -05:00
parent 8a90b216fd
commit 39578d4c61
2 changed files with 3 additions and 1 deletions
+2
View File
@@ -51,6 +51,7 @@ class Alarm: Codable
var text: String
var wakeMethod: WVM
var alarmTone: SystemSoundID
var notificationID: String
/// What days does it repeat (Sun, Mon, Tue, Wed, Thu, Fri, Sat)
var repeats: [Bool]
@@ -74,6 +75,7 @@ class Alarm: Codable
self.repeats = repeats
self.lastActivate = lastActivate
self.alarmTone = alarmTone
self.notificationID = "notification.id.\(Int.random(in: 1...Int.max))"
}
/// Does it automatically disable after activating once
+1 -1
View File
@@ -38,7 +38,7 @@ class Notification {
// Scheduels alarm notification for proper time
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: alarm.nextActivate!.timeIntervalSince(Date()), repeats: false)
let request = UNNotificationRequest(identifier: "notification.id.01", content: content, trigger: trigger)
let request = UNNotificationRequest(identifier: alarm.notificationID, content: content, trigger: trigger)
// Sends notification
UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)