add ability to delete an entry aka mark it missing
make entire row tappable instead of just content closed #46
This commit is contained in:
@@ -63,6 +63,16 @@ struct ContentView: View {
|
||||
showUpdateEntryAlert = false
|
||||
})
|
||||
}
|
||||
|
||||
if deleteEnabled {
|
||||
Button(String(localized: "content_view_delete_entry"), action: {
|
||||
if let selectedMissingEntry = selectedEntry {
|
||||
viewModel.update(entry: selectedMissingEntry, toMood: Mood.missing)
|
||||
}
|
||||
showUpdateEntryAlert = false
|
||||
})
|
||||
}
|
||||
|
||||
Button(String(localized: "content_view_fill_in_missing_entry_cancel"), role: .cancel, action: {
|
||||
selectedEntry = nil
|
||||
showUpdateEntryAlert = false
|
||||
@@ -190,18 +200,12 @@ struct ContentView: View {
|
||||
return $0.forDate! > $1.forDate!
|
||||
}), id: \.self) { entry in
|
||||
entryListView(entry: entry)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture(perform: {
|
||||
selectedEntry = entry
|
||||
showUpdateEntryAlert = true
|
||||
})
|
||||
}
|
||||
// if deleteEnabled {
|
||||
// .onDelete(perform: { offsets in
|
||||
// withAnimation {
|
||||
// viewModel.delete(offsets: offsets, inMonth: month, inYear: year)
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@ struct SettingsView: View {
|
||||
if useCloudKit {
|
||||
cloudKitStatus
|
||||
}
|
||||
|
||||
canDelete
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user