Add weather feature with WeatherKit integration for mood entries
Fetch and display weather data (temp, condition, hi/lo, humidity) when users log a mood. Weather is stored as JSON on MoodEntryModel and shown as a card in EntryDetailView. Premium-gated with location permission prompt. Includes BGTask retry for failed fetches and full analytics. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -187,6 +187,12 @@ struct EntryDetailView: View {
|
||||
// Notes section
|
||||
notesSection
|
||||
|
||||
// Weather section
|
||||
if let weatherJSON = entry.weatherJSON,
|
||||
let weatherData = WeatherData.decode(from: weatherJSON) {
|
||||
weatherSection(weatherData)
|
||||
}
|
||||
|
||||
// Photo section
|
||||
photoSection
|
||||
|
||||
@@ -411,6 +417,16 @@ struct EntryDetailView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private func weatherSection(_ weatherData: WeatherData) -> some View {
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
Text("Weather")
|
||||
.font(.headline)
|
||||
.foregroundColor(textColor)
|
||||
|
||||
WeatherCardView(weatherData: weatherData)
|
||||
}
|
||||
}
|
||||
|
||||
private var photoSection: some View {
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
HStack {
|
||||
|
||||
Reference in New Issue
Block a user