Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/HeartCoach/Shared/Services/LocalStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,17 @@ public final class LocalStore: ObservableObject {
// Encryption unavailable — do NOT fall back to plaintext for health data.
// Data is dropped rather than stored unencrypted. The next successful
// save will restore it. This protects PHI at the cost of temporary data loss.
#if DEBUG
print("[LocalStore] ERROR: Encryption unavailable for key \(key.rawValue). Data NOT saved to protect health data privacy.")
#endif
#if DEBUG
assertionFailure("CryptoService.encrypt() returned nil for key \(key.rawValue). Fix Keychain access or mock CryptoService in tests.")
#endif
}
} catch {
#if DEBUG
print("[LocalStore] ERROR: Failed to encode \(T.self) for key \(key.rawValue): \(error)")
#endif
}
}

Expand Down Expand Up @@ -342,10 +346,12 @@ public final class LocalStore: ObservableObject {
// Both encrypted and plain-text decoding failed — data is corrupted
// or from an incompatible schema version. Remove the bad entry so the
// app can start fresh instead of crashing on every launch.
#if DEBUG
print(
"[LocalStore] WARNING: Removing unreadable \(T.self) "
+ "from key \(key.rawValue). Stored data was corrupted or incompatible."
)
#endif
defaults.removeObject(forKey: key.rawValue)
return nil
}
Expand Down
1 change: 1 addition & 0 deletions apps/HeartCoach/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ settings:
SWIFT_VERSION: "5.9"
ENABLE_USER_SCRIPT_SANDBOXING: true
DEAD_CODE_STRIPPING: true
CODE_SIGN_STYLE: Automatic

############################################################
# Targets
Expand Down
Loading