Complete rename across all bundle IDs, App Groups, CloudKit containers, StoreKit product IDs, data store filenames, URL schemes, logger subsystems, Swift identifiers, user-facing strings (7 languages), file names, directory names, Xcode project, schemes, assets, and documentation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7.5 KiB
Apple Platform Features
This document covers the new Apple-specific features integrated into Reflect, including how to trigger and test each one.
1. Control Center Widget
File: ReflectWidget/ReflectMoodControlWidget.swift (ReflectMoodControlWidget)
What it does: Adds a quick-access button to Control Center that opens Reflect to log your mood.
How to Add to Control Center
- Open Settings > Control Center
- Scroll down to find Reflect - Log Mood
- Tap the + button to add it
- Alternatively: Swipe down from top-right, tap + button, find Reflect
How to Test
- Add the widget to Control Center (steps above)
- Open Control Center (swipe down from top-right corner)
- Tap the "Log Mood" button
- Reflect app should open
Implementation Details
- Uses
ControlWidgetandStaticControlConfiguration OpenReflectIntent(AppIntent) handles the button tapopenAppWhenRun = trueensures the app opens
2. HealthKit State of Mind API
File: Shared/HealthKitManager.swift
What it does: Syncs mood entries to Apple Health using the State of Mind API, allowing users to see mood correlations with sleep, exercise, and other health metrics.
Setup Required
- Enable HealthKit in Settings > Reflect > Health
- Grant write permission for "State of Mind"
How to Test
- Go to Reflect settings and enable HealthKit sync
- Log a mood entry
- Open Apple Health app
- Go to Browse > Mental Wellbeing > State of Mind
- Your mood entry should appear with the corresponding valence
Mood to Valence Mapping
| Mood | Valence | HealthKit Labels |
|---|---|---|
| Horrible | -1.0 | stressed, anxious |
| Bad | -0.5 | sad, discouraged |
| Average | 0.0 | peaceful, content |
| Good | 0.5 | happy, joyful |
| Great | 1.0 | excited, grateful |
Implementation Details
- Uses
HKStateOfMindwithkind: .dailyMood - Valence ranges from -1.0 (very unpleasant) to 1.0 (very pleasant)
- Automatically syncs when mood is logged (if enabled)
3. App Intents / Siri Shortcuts
File: Shared/AppShortcuts.swift
What it does: Enables voice-activated mood logging via Siri and adds shortcuts to the Shortcuts app.
Available Shortcuts
Log Mood
- Phrases:
- "Log my mood in Reflect"
- "Log mood as [mood] in Reflect"
- "Record my mood in Reflect"
- "I'm feeling [mood] in Reflect"
- "Track my mood in Reflect"
Check Today's Mood
- Phrases:
- "What's my mood today in Reflect"
- "Check today's mood in Reflect"
- "How am I feeling in Reflect"
Get Mood Streak
- Phrases:
- "What's my mood streak in Reflect"
- "Check my streak in Reflect"
- "How many days in a row in Reflect"
How to Test
- Say "Hey Siri, log my mood in Reflect"
- Siri will prompt you to select a mood (Horrible, Bad, Average, Good, Great)
- Confirm selection
- Siri responds with confirmation and shows a visual snippet
How to Add to Shortcuts App
- Open Shortcuts app
- Tap + to create new shortcut
- Search for "Reflect"
- Available actions: Log Mood, Check Today's Mood, Get Mood Streak
Implementation Details
MoodEntityprovides the mood options for Siri parameter selectionLogMoodIntentsaves to DataController and optionally syncs to HealthKitMoodLoggedSnippetViewshows visual confirmation in Siri
4. Custom Tips System
Files:
Shared/ReflectTips.swift(Tips definitions and manager)Shared/Views/TipModalView.swift(Modal UI)
What it does: Shows themed modal tips to help users discover features throughout the app. Tips appear as beautiful sheets that match the app's current theme.
Available Tips
| Tip | Location | Trigger |
|---|---|---|
| CustomizeLayoutTip | Customize screen | First visit |
| AIInsightsTip | Insights tab | After 7 moods logged |
| SiriShortcutTip | Settings | After 3 mood logs |
| HealthKitSyncTip | Settings | After viewing settings |
| WidgetVotingTip | Day view | After 2 days usage |
| TimeViewTip | Day view | First visit |
| MoodStreakTip | Day view | When streak >= 3 |
How to Test
- Tips appear automatically based on conditions (one per session)
- To reset tips for testing:
ReflectTipsManager.shared.resetAllTips()
- To disable tips globally:
ReflectTipsManager.shared.tipsEnabled = false
Implementation Details
ReflectTipsManager.shared.resetSession()called inReflectApp.init()- Each tip has
isEligibleproperty based on user activity parameters - Tips show as themed modal sheets with gradient headers
- Only one tip shown per app session
5. Live Activities
Files:
Shared/MoodStreakActivity.swift(Manager + Attributes)ReflectWidget/ReflectMoodControlWidget.swift(Widget views)
What it does: Shows mood streak progress on the Lock Screen and Dynamic Island.
How to Start a Live Activity
// In your code where you want to start tracking
await LiveActivityManager.shared.startStreakActivity(
streak: currentStreak,
lastMood: todaysMood,
hasLoggedToday: true
)
How to Update After Mood Log
LiveActivityManager.shared.updateActivity(
streak: newStreak,
mood: loggedMood
)
How to End Activity
await LiveActivityManager.shared.endAllActivities()
Live Activity Views
Lock Screen View
- Shows flame icon with streak count
- Displays today's mood with color indicator
- Shows "Don't break your streak!" prompt if not logged
Dynamic Island
- Compact: Flame icon + streak number
- Expanded: Full streak info, mood status, voting window countdown
- Minimal: Flame icon only
How to Test
- Ensure Live Activities are enabled: Settings > Reflect > Live Activities
- Start a Live Activity (see code above)
- Lock your phone to see Lock Screen view
- On iPhone 14 Pro+, check Dynamic Island
Requirements
- iPhone with iOS 16.1+ (Lock Screen)
- iPhone 14 Pro/Pro Max+ for Dynamic Island
NSSupportsLiveActivities = truein Info.plist (already configured)
Implementation Details
MoodStreakAttributesdefines the activity data structureActivityConfigurationrenders both Lock Screen and Dynamic Island- Activities automatically end at midnight via
scheduleActivityEnd()
Entry Types
New entry types added to track mood entry sources:
| Type | Raw Value | Description |
|---|---|---|
.siri |
7 | Logged via Siri voice command |
.controlCenter |
8 | Logged via Control Center widget |
.liveActivity |
9 | Logged via Live Activity tap |
Entitlements & Info.plist
Entitlements (Reflect (iOS).entitlements)
com.apple.developer.healthkit- HealthKit accesscom.apple.developer.healthkit.access- health-records
Info.plist (Reflect--iOS--Info.plist)
NSSupportsLiveActivities- Enables Live ActivitiesNSHealthShareUsageDescription- HealthKit read permission descriptionNSHealthUpdateUsageDescription- HealthKit write permission description
Widget Info.plist (ReflectWidgetExtension-Info.plist)
NSSupportsLiveActivities- Enables Live Activity widget
Testing Checklist
- Control Center widget appears and opens app
- Siri responds to "Log my mood in Reflect"
- Siri shows mood options and confirms selection
- HealthKit sync writes State of Mind entries
- Tips appear at appropriate times
- Live Activity shows on Lock Screen
- Dynamic Island updates (iPhone 14 Pro+)
- Entry types correctly recorded in database