Implemented bulk notification schedueling after restore.

This commit is contained in:
Aaron
2021-01-26 22:47:16 -05:00
parent 65eeea22e8
commit 57e5eca0f9
3 changed files with 7 additions and 4 deletions
+3
View File
@@ -199,6 +199,9 @@ class ManageVC: UIViewController
// Update UI // Update UI
AlarmViewController.staticTable?.reloadData() AlarmViewController.staticTable?.reloadData()
// Schedule any missing notifications
Notification.bulkScheduleNotifications(alarms: Alarms.fromLocal().list)
self.msg("Success!", "You're restored your backup.") self.msg("Success!", "You're restored your backup.")
} }
} }
+2 -2
View File
@@ -156,9 +156,9 @@ class AddAlarmViewController: UIViewController
//Schedules notification for the alarm //Schedules notification for the alarm
if editFlag{ if editFlag{
Notification(alarm: oldAlarm!).removeNotification() Notification.removeNotification(alarm: oldAlarm!)
} }
Notification(alarm: alarm).scheduleNotification() Notification.scheduleNotification(alarm: alarm)
// Dismiss this view // Dismiss this view
self.dismiss(animated: true, completion: nil) self.dismiss(animated: true, completion: nil)
+2 -2
View File
@@ -30,7 +30,7 @@ class DebugViewController: UIViewController
//Sends a test notification //Sends a test notification
@IBAction func sendNotification(_ sender: Any) @IBAction func sendNotification(_ sender: Any)
{ {
Notification(alarm: Alarms.fromLocal().listEnabled[0]).scheduleNotification() Notification.scheduleNotification(alarm: Alarms.fromLocal().listEnabled[0])
} }
@IBAction func addAlarm(_ sender: Any) @IBAction func addAlarm(_ sender: Any)
@@ -39,7 +39,7 @@ class DebugViewController: UIViewController
let alarm = Alarm(hour: h, minute: m, text: "Test alarm - \(h * m)", wakeMethod: wvms[1], repeats: [true, true, true, true, true, true, true], lastActivate: Date().added(.minute, -1)) let alarm = Alarm(hour: h, minute: m, text: "Test alarm - \(h * m)", wakeMethod: wvms[1], repeats: [true, true, true, true, true, true, true], lastActivate: Date().added(.minute, -1))
Alarms.fromLocal().apply { $0.list.append(alarm) }.localSave() Alarms.fromLocal().apply { $0.list.append(alarm) }.localSave()
Notification(alarm: alarm).scheduleNotification() Notification.scheduleNotification(alarm: alarm)
} }
@IBAction func deleteAlarm(_ sender: Any) @IBAction func deleteAlarm(_ sender: Any)