feat: move HealthKit permission to onboarding, remove HR write
- Add .health step to onboarding between frequency and ready - HealthStep with non-blocking permission flow (Not Now skips) - Remove requestAuthorization() from PlayerViewModel.startWorkout() - Guard live session start with isAuthorized check - Remove heart rate write from HealthKit authorization popup - Remove HR sample writing from saveWorkout (now without permission) - Add L10n keys: healthAccess, healthAccessSubtitle, allowHealthAccess, notNow - Add EN/DE/ES/FR translations - Track permission decisions through analytics - Entry animation on HealthStep (fade-in + slide-up) HealthKit permission is now asked once during onboarding, never interrupting workouts again.
This commit is contained in:
@@ -19,7 +19,6 @@ actor HealthKitService {
|
||||
[
|
||||
HKWorkoutType.workoutType(),
|
||||
HKQuantityType(.activeEnergyBurned),
|
||||
HKQuantityType(.heartRate),
|
||||
]
|
||||
}
|
||||
|
||||
@@ -87,20 +86,6 @@ actor HealthKitService {
|
||||
try await builder.addSamples([sample])
|
||||
}
|
||||
|
||||
// Heart rate samples (if captured during workout)
|
||||
if let avgHR = data.averageHeartRate {
|
||||
let hrType = HKQuantityType(.heartRate)
|
||||
let hrUnit = HKUnit.count().unitDivided(by: .minute())
|
||||
let hrQuantity = HKQuantity(unit: hrUnit, doubleValue: avgHR)
|
||||
let hrSample = HKQuantitySample(
|
||||
type: hrType,
|
||||
quantity: hrQuantity,
|
||||
start: data.startedAt,
|
||||
end: data.completedAt
|
||||
)
|
||||
try await builder.addSamples([hrSample])
|
||||
}
|
||||
|
||||
try await builder.endCollection(at: data.completedAt)
|
||||
guard let workout = try await builder.finishWorkout() else {
|
||||
throw HealthKitError.workoutSaveFailed
|
||||
|
||||
Reference in New Issue
Block a user