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:
@@ -42,6 +42,9 @@ final class MoodEntryModel {
|
||||
var notes: String?
|
||||
var photoID: UUID?
|
||||
|
||||
// Weather
|
||||
var weatherJSON: String?
|
||||
|
||||
// Computed properties
|
||||
var mood: Mood {
|
||||
Mood(rawValue: moodValue) ?? .missing
|
||||
@@ -58,7 +61,8 @@ final class MoodEntryModel {
|
||||
canEdit: Bool = true,
|
||||
canDelete: Bool = true,
|
||||
notes: String? = nil,
|
||||
photoID: UUID? = nil
|
||||
photoID: UUID? = nil,
|
||||
weatherJSON: String? = nil
|
||||
) {
|
||||
self.forDate = forDate
|
||||
self.moodValue = mood.rawValue
|
||||
@@ -69,6 +73,7 @@ final class MoodEntryModel {
|
||||
self.canDelete = canDelete
|
||||
self.notes = notes
|
||||
self.photoID = photoID
|
||||
self.weatherJSON = weatherJSON
|
||||
}
|
||||
|
||||
// Convenience initializer for raw values
|
||||
@@ -81,7 +86,8 @@ final class MoodEntryModel {
|
||||
canEdit: Bool = true,
|
||||
canDelete: Bool = true,
|
||||
notes: String? = nil,
|
||||
photoID: UUID? = nil
|
||||
photoID: UUID? = nil,
|
||||
weatherJSON: String? = nil
|
||||
) {
|
||||
self.forDate = forDate
|
||||
self.moodValue = moodValue
|
||||
@@ -92,5 +98,6 @@ final class MoodEntryModel {
|
||||
self.canDelete = canDelete
|
||||
self.notes = notes
|
||||
self.photoID = photoID
|
||||
self.weatherJSON = weatherJSON
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user