Merge branch 'develop' into sharing

This commit is contained in:
Trey t
2022-02-10 11:54:42 -06:00
11 changed files with 101 additions and 29 deletions

View File

@@ -71,6 +71,7 @@ struct ContentView: View {
viewModel.update(entry: selectedEntry, toMood: mood)
}
showUpdateEntryAlert = false
selectedEntry = nil
})
}
@@ -279,7 +280,7 @@ struct ContentView: View {
if viewModel.shouldShowVotingHeader() {
AddMoodHeaderView(addItemHeaderClosure: { (mood, date) in
withAnimation {
viewModel.add(mood: mood, forDate: date)
viewModel.add(mood: mood, forDate: date, entryType: .header)
}
})
.frame(height: headerHeight)
@@ -319,7 +320,7 @@ struct ContentView: View {
.padding()
AddMoodHeaderView(addItemHeaderClosure: { (mood, date) in
withAnimation {
viewModel.add(mood: mood, forDate: date)
viewModel.add(mood: mood, forDate: date, entryType: .header)
}
}, overrideDay: viewModel.shouldShowVotingHeader() ? .Today : .Previous)
}
@@ -368,6 +369,10 @@ struct ContentView: View {
theme.currentTheme.bg
.edgesIgnoringSafeArea(.all)
)
.onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in
PersistenceController.shared.fillInMissingDates()
viewModel.updateData()
}
}
}

View File

@@ -58,13 +58,20 @@ struct SmallRollUpHeaderView: View {
private var circularViews: some View {
HStack {
ForEach(entries, id: \.0) { (mood, value) in
Text(String(value))
.font(.title)
.fontWeight(.bold)
.frame(maxWidth: .infinity)
.padding()
.background(Circle().fill(mood.color))
.foregroundColor(Color(UIColor.white))
ZStack {
Circle().fill(mood.color)
.frame(width: 50, height: 50)
Text(String(value))
.font(.title)
.fontWeight(.bold)
.frame(maxWidth: 50)
.foregroundColor(Color(UIColor.white))
.scaledToFill()
.minimumScaleFactor(0.5)
.lineLimit(1)
}
.padding([.leading, .trailing], 5)
}
}
}