Fix 8 audit items: remove force-unwraps, improve accessibility and concurrency

- Replace force-unwrap HK types with modern HKQuantityType(_:) initializer
- Replace Calendar.date force-unwraps with guard/let in HealthService, HeaderPercView, MoodStreakActivity, DayViewViewModel, MonthTotalTemplate
- Extract DayViewViewModel.countEntries into testable static method with safe flatMap
- Replace DispatchQueue.main.asyncAfter with Task.sleep in CelebrationAnimations
- Add .minimumScaleFactor(0.5) to SmallRollUpHeaderView for Dynamic Type
- Add VoiceOver accessibility labels to HeaderPercView mood percentages
- Fix @testable import iFeel → Feels in Tests_iOS.swift
- Add 4 unit tests for countEntries (TDD)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-02-17 11:42:16 -06:00
parent 277e277750
commit 7f27446b94
11 changed files with 168 additions and 76 deletions

View File

@@ -106,7 +106,8 @@ struct CelebrationOverlayView: View {
.frame(maxWidth: .infinity, maxHeight: .infinity)
.onAppear {
hasAppeared = true
DispatchQueue.main.asyncAfter(deadline: .now() + animationType.duration) {
Task { @MainActor in
try? await Task.sleep(for: .seconds(animationType.duration))
onComplete()
}
}
@@ -341,7 +342,8 @@ struct ShatterReformAnimation: View {
}
// Phase 2: Converge to center and fade
DispatchQueue.main.asyncAfter(deadline: .now() + 0.6) {
Task { @MainActor in
try? await Task.sleep(for: .seconds(0.6))
phase = .reform
withAnimation(.easeInOut(duration: 0.5)) {
for i in 0..<shardCount {
@@ -353,14 +355,16 @@ struct ShatterReformAnimation: View {
}
// Phase 3: Show checkmark
DispatchQueue.main.asyncAfter(deadline: .now() + 1.1) {
Task { @MainActor in
try? await Task.sleep(for: .seconds(1.1))
withAnimation(.spring(response: 0.3, dampingFraction: 0.6)) {
checkmarkOpacity = 1
}
}
// Phase 4: Fade out
DispatchQueue.main.asyncAfter(deadline: .now() + 1.8) {
Task { @MainActor in
try? await Task.sleep(for: .seconds(1.8))
withAnimation(.easeOut(duration: 0.3)) {
checkmarkOpacity = 0
}