Stabilize iOS/watchOS/tvOS apps and add cross-platform audit remediation

This commit is contained in:
Trey t
2026-02-11 12:54:40 -06:00
parent e40275e694
commit acce712261
77 changed files with 2940 additions and 765 deletions

View File

@@ -7,10 +7,12 @@
import WatchKit
import HealthKit
import os
class WatchDelegate: NSObject, WKApplicationDelegate {
private let logger = Logger(subsystem: "com.werkout.watch", category: "lifecycle")
func applicationDidFinishLaunching() {
autorizeHealthKit()
authorizeHealthKit()
}
func applicationDidBecomeActive() {
@@ -25,17 +27,24 @@ class WatchDelegate: NSObject, WKApplicationDelegate {
// WatchWorkout.shared.startWorkout()
}
func autorizeHealthKit() {
let healthKitTypes: Set = [
HKObjectType.quantityType(forIdentifier: .heartRate)!,
HKObjectType.quantityType(forIdentifier: .activeEnergyBurned)!,
HKObjectType.quantityType(forIdentifier: .oxygenSaturation)!,
func authorizeHealthKit() {
guard let heartRateType = HKObjectType.quantityType(forIdentifier: .heartRate),
let activeEnergyType = HKObjectType.quantityType(forIdentifier: .activeEnergyBurned),
let oxygenSaturationType = HKObjectType.quantityType(forIdentifier: .oxygenSaturation) else {
logger.error("Missing required HealthKit quantity types during authorization")
return
}
let healthKitTypes: Set<HKObjectType> = [
heartRateType,
activeEnergyType,
oxygenSaturationType,
HKObjectType.activitySummaryType(),
HKQuantityType.workoutType()
]
HKHealthStore().requestAuthorization(toShare: nil, read: healthKitTypes) { (succ, error) in
if !succ {
fatalError("Error requesting authorization from health store: \(String(describing: error)))")
self.logger.error("HealthKit authorization failed: \(String(describing: error), privacy: .public)")
}
}
}