Add premium features and reorganize Settings tab
Premium Features: - Journal notes and photo attachments for mood entries - Data export (CSV and PDF reports) - Privacy lock with Face ID/Touch ID - Apple Health integration for mood correlation - 4 new personality packs (Motivational Coach, Zen Master, Best Friend, Data Analyst) Settings Tab Reorganization: - Combined Customize and Settings into single tab with segmented control - Added upgrade banner with trial countdown above segment - "Why Upgrade?" sheet showing all premium benefits - Subscribe button opens improved StoreKit 2 subscription view UI Improvements: - Enhanced subscription store with feature highlights - Entry detail view for viewing/editing notes and photos - Removed duplicate subscription banners from tab content 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -44,6 +44,7 @@ class InsightsViewModel: ObservableObject {
|
||||
// MARK: - Dependencies
|
||||
|
||||
private let insightService = FoundationModelsInsightService()
|
||||
private let healthService = HealthService.shared
|
||||
private let calendar = Calendar.current
|
||||
|
||||
// MARK: - Initialization
|
||||
@@ -148,11 +149,28 @@ class InsightsViewModel: ObservableObject {
|
||||
|
||||
updateState(.loading)
|
||||
|
||||
// Fetch health data if enabled
|
||||
var healthCorrelations: [HealthCorrelation] = []
|
||||
if healthService.isEnabled && healthService.isAuthorized {
|
||||
let healthData = await healthService.fetchHealthData(for: validEntries)
|
||||
let correlations = healthService.analyzeCorrelations(entries: validEntries, healthData: healthData)
|
||||
|
||||
// Convert to HealthCorrelation format
|
||||
healthCorrelations = correlations.map {
|
||||
HealthCorrelation(
|
||||
metric: $0.metric,
|
||||
insight: $0.insight,
|
||||
correlation: $0.correlation
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
let insights = try await insightService.generateInsights(
|
||||
for: validEntries,
|
||||
periodName: periodName,
|
||||
count: 5
|
||||
count: 5,
|
||||
healthCorrelations: healthCorrelations
|
||||
)
|
||||
updateInsights(insights)
|
||||
updateState(.loaded)
|
||||
|
||||
Reference in New Issue
Block a user