Fix 25 audit issues: memory leaks, concurrency, performance, accessibility
Address findings from comprehensive audit across 5 workstreams: - Memory: Token-based DataController listeners (prevent closure leaks), static DateFormatters, ImageCache observer cleanup, MotionManager reference counting, FoundationModels dedup guard - Concurrency: Replace Task.detached with Task in FeelsApp (preserve MainActor isolation), wrap WatchConnectivity handler in MainActor - Performance: Cache sortedGroupedData in DayViewViewModel, cache demo data in MonthView/YearView, remove broken ReduceMotionModifier - Accessibility: VoiceOver support for LockScreen, DemoHeatmapCell labels, MonthCard button labels, InsightsView header traits, Smart Invert protection on neon headers Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -106,7 +106,7 @@ struct FeelsApp: App {
|
||||
}
|
||||
|
||||
// Defer all non-critical foreground work to avoid blocking UI
|
||||
Task.detached(priority: .utility) { @MainActor in
|
||||
Task(priority: .utility) {
|
||||
// Refresh from disk to pick up widget/watch changes
|
||||
DataController.shared.refreshFromDisk()
|
||||
|
||||
@@ -124,17 +124,17 @@ struct FeelsApp: App {
|
||||
}
|
||||
|
||||
// Defer Live Activity scheduling (heavy DB operations)
|
||||
Task.detached(priority: .utility) {
|
||||
Task(priority: .utility) {
|
||||
await LiveActivityScheduler.shared.scheduleBasedOnCurrentTime()
|
||||
}
|
||||
|
||||
// Catch up on side effects from widget/watch votes
|
||||
Task.detached(priority: .utility) {
|
||||
Task(priority: .utility) {
|
||||
await MoodLogger.shared.processPendingSideEffects()
|
||||
}
|
||||
|
||||
// Check subscription status (network call) - throttled
|
||||
Task.detached(priority: .background) {
|
||||
Task(priority: .background) {
|
||||
await iapManager.checkSubscriptionStatus()
|
||||
await iapManager.trackSubscriptionAnalytics(source: "app_foreground")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user