add ability to rate a missing day
made bgview equatable so it doesn't get redrawn each time a sheet is shown add more string to localization fill in missing data on launch ... incase they have bgfetch turned off
This commit is contained in:
@@ -15,7 +15,9 @@ struct ContentView: View {
|
||||
|
||||
@State private var showingSheet = false
|
||||
@State private var showTodayInput = true
|
||||
|
||||
@State private var selectedMissingEntry: MoodEntry?
|
||||
@State private var showMissingAlert = false
|
||||
|
||||
@ObservedObject var viewModel = ContentModeViewModel()
|
||||
|
||||
init(){
|
||||
@@ -46,7 +48,20 @@ struct ContentView: View {
|
||||
needsOnboarding = false
|
||||
viewModel.updateOnboardingData(onboardingData: onboardingData)
|
||||
})
|
||||
})
|
||||
}).alert(String(localized: "content_view_fill_in_missing_entry"), isPresented: $showMissingAlert) {
|
||||
ForEach(Mood.allValues) { mood in
|
||||
Button(mood.strValue, action: {
|
||||
if let selectedMissingEntry = selectedMissingEntry {
|
||||
viewModel.update(entry: selectedMissingEntry, toMood: mood)
|
||||
}
|
||||
showMissingAlert = false
|
||||
})
|
||||
}
|
||||
Button(String(localized: "content_view_fill_in_missing_entry_cancel"), role: .cancel, action: {
|
||||
selectedMissingEntry = nil
|
||||
showMissingAlert = false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private var settingsButtonView: some View {
|
||||
@@ -114,9 +129,15 @@ struct ContentView: View {
|
||||
}) {
|
||||
// for reach all entries
|
||||
ForEach(entries.sorted(by: {
|
||||
$0.forDate! > $1.forDate!
|
||||
return $0.forDate! > $1.forDate!
|
||||
}), id: \.self) { entry in
|
||||
entryListView(entry: entry)
|
||||
.onTapGesture(perform: {
|
||||
if entry.moodValue == Mood.missing.rawValue {
|
||||
selectedMissingEntry = entry
|
||||
showMissingAlert = true
|
||||
}
|
||||
})
|
||||
}.onDelete(perform: { offsets in
|
||||
withAnimation {
|
||||
viewModel.delete(offsets: offsets, inMonth: month, inYear: year)
|
||||
@@ -167,7 +188,9 @@ struct ContentView: View {
|
||||
|
||||
private var mainView: some View {
|
||||
ZStack {
|
||||
BGView()
|
||||
|
||||
BGView().equatable()
|
||||
|
||||
VStack{
|
||||
settingsButtonView
|
||||
if viewModel.shouldShowVotingHeader() {
|
||||
@@ -182,7 +205,7 @@ struct ContentView: View {
|
||||
HeaderStatsView(fakeData: false, backDays: 30)
|
||||
.frame(height: 180)
|
||||
// should match backDays above
|
||||
Text("Past \(30) days")
|
||||
Text(String(format: String(localized: "content_view_header_title"), 30))
|
||||
.font(.body)
|
||||
.foregroundColor(Color(UIColor.systemGray))
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
|
||||
Reference in New Issue
Block a user