Fix memory leaks and add debug tools, remove ControlCenterTip

Memory optimization:
- Add onDisappear cleanup for repeatForever animations in LockScreenView
- Add onDisappear cleanup for animations in FeelsSubscriptionStoreView
- Add onDisappear cleanup in AddMoodHeaderView and PaywallPreviewSettingsView

Debug improvements:
- Add test data and clear data buttons to Settings (debug builds only)

TipKit changes:
- Remove ControlCenterTip (unused)
- Add TipKit-Tips.md documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Trey t
2025-12-28 21:07:22 -06:00
parent c4e013763a
commit e98142c72e
9 changed files with 370 additions and 60 deletions

View File

@@ -126,7 +126,6 @@ This document covers the new Apple-specific features integrated into Feels, incl
| WidgetVotingTip | Day view | After first mood log |
| TimeViewTip | Day view header | After 2 days usage |
| MoodStreakTip | Day view | When streak >= 3 |
| ControlCenterTip | Settings | After 10 mood logs |
### How to Test
1. Tips appear automatically based on conditions

152
docs/TipKit-Tips.md Normal file
View File

@@ -0,0 +1,152 @@
# TipKit Tips Documentation
This document describes all TipKit tips implemented in the Feels app, including their display conditions and locations.
## Overview
Tips are managed by `TipsManager` (singleton) and configured with:
- **Display Frequency**: Daily
- **Datastore Location**: Application default
---
## Tips
### 1. CustomizeLayoutTip
**Title**: "Personalize Your Experience"
**Message**: "Tap here to customize mood icons, colors, and layouts."
**Icon**: `paintbrush`
**Display Conditions**: Always eligible (no rules)
**Location**: CustomizeContentView (top of the Customize tab in Settings)
---
### 2. AIInsightsTip
**Title**: "Discover AI Insights"
**Message**: "Get personalized insights about your mood patterns powered by Apple Intelligence."
**Icon**: `brain`
**Display Conditions**:
- User has logged at least **7 moods**
**Parameter**: `hasLoggedMoods: Int` (incremented via `TipsManager.shared.onMoodLogged()`)
**Location**: InsightsView
---
### 3. SiriShortcutTip
**Title**: "Use Siri to Log Moods"
**Message**: "Say 'Hey Siri, log my mood as great in Feels' for hands-free logging."
**Icon**: `mic.fill`
**Display Conditions**:
- User has logged at least **3 moods**
**Parameter**: `moodLogCount: Int` (incremented via `TipsManager.shared.onMoodLogged()`)
**Location**: SettingsContentView (Features section header, via `.siriShortcutTip()`)
---
### 4. HealthKitSyncTip
**Title**: "Sync with Apple Health"
**Message**: "Connect to Apple Health to see your mood data alongside sleep, exercise, and more."
**Icon**: `heart.fill`
**Display Conditions**:
- User has viewed the Settings screen
**Parameter**: `hasSeenSettings: Bool` (set via `TipsManager.shared.onSettingsViewed()`)
**Location**: SettingsContentView (Health Kit toggle, via `.healthKitSyncTip()`)
---
### 5. WidgetVotingTip
**Title**: "Vote from Your Home Screen"
**Message**: "Add the Mood Vote widget to quickly log your mood without opening the app."
**Icon**: `square.grid.2x2`
**Display Conditions**:
- User has been using the app for at least **2 days**
**Parameter**: `daysUsingApp: Int` (updated via `TipsManager.shared.updateDaysUsingApp(_:)`)
**Location**: DayView
---
### 6. TimeViewTip
**Title**: "View Your History"
**Message**: "Switch between Day, Month, and Year views to see your mood patterns over time."
**Icon**: `calendar`
**Display Conditions**: Always eligible (no rules)
**Location**: DayView
---
### 7. MoodStreakTip
**Title**: "Build Your Streak!"
**Message**: "Log your mood daily to build a streak. Consistency helps you understand your patterns."
**Icon**: `flame.fill`
**Display Conditions**:
- User has a current streak of at least **3 days**
**Parameter**: `currentStreak: Int` (updated via `TipsManager.shared.updateStreak(_:)`)
**Location**: DayView
---
## TipsManager API
```swift
// Configure tips (call on app launch)
TipsManager.shared.configure()
// Reset all tips (for testing)
TipsManager.shared.resetAllTips()
// Update parameters
TipsManager.shared.onMoodLogged() // Increments mood log count
TipsManager.shared.onSettingsViewed() // Marks settings as viewed
TipsManager.shared.updateDaysUsingApp(_:) // Updates days using app
TipsManager.shared.updateStreak(_:) // Updates current streak
```
---
## View Modifiers
Tips can be attached to views using these convenience modifiers:
```swift
.customizeLayoutTip()
.aiInsightsTip()
.siriShortcutTip()
.healthKitSyncTip()
.widgetVotingTip()
.timeViewTip()
.moodStreakTip()
```
---
## Files
- **Definition**: `Shared/FeelsTips.swift`
- **Manager**: `TipsManager` class in same file
- **Configuration**: Called in `FeelsApp.swift`