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:
@@ -49,6 +49,10 @@ protocol MoodDataWriting {
|
||||
@discardableResult
|
||||
func updatePhoto(forDate date: Date, photoID: UUID?) -> Bool
|
||||
|
||||
/// Update weather for an entry
|
||||
@discardableResult
|
||||
func updateWeather(forDate date: Date, weatherJSON: String?) -> Bool
|
||||
|
||||
/// Fill in missing dates with placeholder entries
|
||||
func fillInMissingDates()
|
||||
|
||||
|
||||
@@ -38,6 +38,19 @@ extension DataController {
|
||||
return true
|
||||
}
|
||||
|
||||
// MARK: - Weather
|
||||
|
||||
@discardableResult
|
||||
func updateWeather(forDate date: Date, weatherJSON: String?) -> Bool {
|
||||
guard let entry = getEntry(byDate: date) else {
|
||||
return false
|
||||
}
|
||||
|
||||
entry.weatherJSON = weatherJSON
|
||||
saveAndRunDataListeners()
|
||||
return true
|
||||
}
|
||||
|
||||
// MARK: - Photo
|
||||
|
||||
@discardableResult
|
||||
|
||||
Reference in New Issue
Block a user