WorkoutKit : étend support strength/core/yoga/HIIT/flexibility + location auto
Mapping HKWorkoutActivityType élargi : - strength → .functionalStrengthTraining - traditional_strength → .traditionalStrengthTraining - core, core_training → .coreTraining (utile pour X Core REHAB) - hiit, high_intensity → .highIntensityIntervalTraining - cross_training → .crossTraining - yoga → .yoga - pilates → .pilates - flexibility, stretching, mobility → .flexibility - swimming → .swimming - mixed → .mixedCardio Location auto : - strength/core/yoga/pilates/flexibility/HIIT/cross → .indoor - cardio outdoor (running, cycling, walking, hiking, swimming) → .outdoor → Permet de pousser des séances strength/core/yoga structurées en blocs intervalles (60s travail / 15s récup × N) sur l'Apple Watch. Idéal pour X Core REHAB et autres séances time-based de Sylvain (gainage, holds, circuit).
This commit is contained in:
@@ -92,10 +92,24 @@ public class CoachWorkoutKitPlugin: CAPPlugin, CAPBridgedPlugin {
|
||||
|
||||
private func workoutActivity(from str: String) -> HKWorkoutActivityType {
|
||||
switch str.lowercased() {
|
||||
// Cardio outdoor
|
||||
case "cycling": return .cycling
|
||||
case "walking": return .walking
|
||||
case "hiking": return .hiking
|
||||
case "running": return .running
|
||||
case "swimming": return .swimming
|
||||
// Strength / renfo
|
||||
case "strength", "functional_strength": return .functionalStrengthTraining
|
||||
case "traditional_strength": return .traditionalStrengthTraining
|
||||
case "core", "core_training": return .coreTraining
|
||||
// HIIT / cross training
|
||||
case "hiit", "high_intensity": return .highIntensityIntervalTraining
|
||||
case "cross_training", "crosstraining": return .crossTraining
|
||||
// Mobilité
|
||||
case "yoga": return .yoga
|
||||
case "pilates": return .pilates
|
||||
case "flexibility", "stretching", "mobility": return .flexibility
|
||||
case "mixed", "mixed_cardio": return .mixedCardio
|
||||
default: return .running
|
||||
}
|
||||
}
|
||||
@@ -136,10 +150,20 @@ public class CoachWorkoutKitPlugin: CAPPlugin, CAPBridgedPlugin {
|
||||
// 5. Cooldown
|
||||
let cooldownStep = WorkoutStep(goal: .time(cooldownMin * 60, .seconds))
|
||||
|
||||
// 6. CustomWorkout
|
||||
// 6. CustomWorkout — location selon l'activité (indoor pour
|
||||
// strength/yoga/core, outdoor pour cardio extérieur).
|
||||
let location: HKWorkoutSessionLocationType
|
||||
switch activity {
|
||||
case .functionalStrengthTraining, .traditionalStrengthTraining,
|
||||
.coreTraining, .yoga, .pilates, .flexibility,
|
||||
.highIntensityIntervalTraining, .crossTraining:
|
||||
location = .indoor
|
||||
default:
|
||||
location = .outdoor
|
||||
}
|
||||
let custom = CustomWorkout(
|
||||
activity: activity,
|
||||
location: .outdoor,
|
||||
location: location,
|
||||
displayName: displayName,
|
||||
warmup: warmupStep,
|
||||
blocks: [block],
|
||||
|
||||
Reference in New Issue
Block a user