Implemented bulk notification schedueling after restore.
This commit is contained in:
@@ -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.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user