|
@@ -15,6 +15,7 @@ struct ContentView: View {
|
|
|
|
|
|
|
|
@Query(sort: \Project.sortOrder) private var items: [Project]
|
|
@Query(sort: \Project.sortOrder) private var items: [Project]
|
|
|
@State private var selection: Project?
|
|
@State private var selection: Project?
|
|
|
|
|
+ @State private var hasAutosave: Bool = false
|
|
|
|
|
|
|
|
var body: some View {
|
|
var body: some View {
|
|
|
NavigationSplitView {
|
|
NavigationSplitView {
|
|
@@ -47,6 +48,13 @@ struct ContentView: View {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
.onAppear(perform: autosave)
|
|
.onAppear(perform: autosave)
|
|
|
|
|
+ .alert("Autosave", isPresented: $hasAutosave) {
|
|
|
|
|
+ Button("OK") {
|
|
|
|
|
+ hasAutosave = false
|
|
|
|
|
+ }
|
|
|
|
|
+ } message: {
|
|
|
|
|
+ Text("All completed tasks/subtasks have been deleted")
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private func addItem() {
|
|
private func addItem() {
|
|
@@ -86,6 +94,7 @@ struct ContentView: View {
|
|
|
SaveController.save(items, toUrl: SaveController.filename(date: ymd))
|
|
SaveController.save(items, toUrl: SaveController.filename(date: ymd))
|
|
|
weekStart = now
|
|
weekStart = now
|
|
|
cleanup()
|
|
cleanup()
|
|
|
|
|
+ hasAutosave = true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private func cleanup() {
|
|
private func cleanup() {
|