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:
Trey t
2026-03-11 00:16:26 -05:00
parent a1340b4deb
commit 31fb2a7fe2
15 changed files with 557 additions and 3 deletions

View File

@@ -451,6 +451,11 @@ extension AnalyticsManager {
case healthKitNotAuthorized
case healthKitSyncCompleted(total: Int, success: Int, failed: Int)
// MARK: Weather
case weatherToggled(enabled: Bool)
case weatherFetched
case weatherFetchFailed(error: String)
// MARK: Navigation
case tabSwitched(tab: String)
case viewHeaderChanged(header: String)
@@ -604,6 +609,14 @@ extension AnalyticsManager {
case .healthKitSyncCompleted(let total, let success, let failed):
return ("healthkit_sync_completed", ["total": total, "success": success, "failed": failed])
// Weather
case .weatherToggled(let enabled):
return ("weather_toggled", ["enabled": enabled])
case .weatherFetched:
return ("weather_fetched", nil)
case .weatherFetchFailed(let error):
return ("weather_fetch_failed", ["error": error])
// Navigation
case .tabSwitched(let tab):
return ("tab_switched", ["tab": tab])