fix(workoutkit): guard displayName par #available(iOS 18.0)
WorkoutStep.displayName est dispo uniquement à partir d'iOS 18. Notre fonction tolère iOS 17+ donc Swift refusait la compilation. Fix : guarde l'assignation par #available(iOS 18.0, *). Sur iOS 17, l'Apple Watch garde l'affichage natif Apple "Travail"/"Récupération". Sur iOS 18+, les labels custom Course/Marche/Vélo etc. s'appliquent. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -163,8 +163,12 @@ public class CoachWorkoutKitPlugin: CAPPlugin, CAPBridgedPlugin {
|
||||
if let zone = spec.hrZone {
|
||||
ws.alert = HeartRateZoneAlert(zone: zone)
|
||||
}
|
||||
if let label = spec.label, !label.isEmpty {
|
||||
ws.displayName = label
|
||||
// displayName n'est dispo qu'à partir d'iOS 18. Sur iOS 17, on
|
||||
// garde l'affichage natif Apple "Travail" / "Récupération".
|
||||
if #available(iOS 18.0, *) {
|
||||
if let label = spec.label, !label.isEmpty {
|
||||
ws.displayName = label
|
||||
}
|
||||
}
|
||||
return IntervalStep(spec.isWork ? .work : .recovery, step: ws)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user