Add task persistence and per-task reminder notifications
Tasks now survive app restarts via UserDefaults JSON. Each task with a due time fires a notification at that exact time; date-only tasks fire at 9am on the due date. Completing or deleting a task cancels its pending notification. ContentView now reschedules on any task change.
This commit is contained in:
@@ -86,11 +86,11 @@ struct ContentView: View {
|
||||
workoutVM.syncWidget()
|
||||
}
|
||||
}
|
||||
.onChange(of: taskVM.tasks.count) { _ in taskVM.syncWidget() }
|
||||
.onChange(of: workoutVM.doneSets) { _ in
|
||||
.onChange(of: taskVM.tasks) { _ in
|
||||
taskVM.syncWidget()
|
||||
NotificationManager.shared.reschedule(workoutVM: workoutVM, taskVM: taskVM)
|
||||
}
|
||||
.onChange(of: taskVM.tasks.filter { !$0.isComplete && $0.quadrant == .urgent }.count) { _ in
|
||||
.onChange(of: workoutVM.doneSets) { _ in
|
||||
NotificationManager.shared.reschedule(workoutVM: workoutVM, taskVM: taskVM)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user