Просмотр исходного кода

Live Activity chart to use updated BG color function

- LiveActivity chart view uses new BG color function to select dynamic BG color if opted in
Auggie Fisher 1 год назад
Родитель
Сommit
b63c7c6832
1 измененных файлов с 8 добавлено и 7 удалено
  1. 8 7
      LiveActivity/LiveActivity.swift

+ 8 - 7
LiveActivity/LiveActivity.swift

@@ -233,13 +233,14 @@ struct LiveActivity: Widget {
                         y: .value("Value", currentValue)
                     ).symbolSize(15)
 
-                    if currentValue > additionalState.highGlucose {
-                        pointMark.foregroundStyle(Color.orange.gradient)
-                    } else if currentValue < additionalState.lowGlucose {
-                        pointMark.foregroundStyle(Color.red.gradient)
-                    } else {
-                        pointMark.foregroundStyle(Color.green.gradient)
-                    }
+                    let color = setBGColor(
+                        bgValue: Int(currentValue),
+                        lowGlucose: Int(additionalState.lowGlucose),
+                        highGlucose: Int(additionalState.highGlucose),
+                        targetGlucose: 90 // Auggie TODO: get the target color from preferences
+                    )
+
+                    pointMark.foregroundStyle(color)
                 }
             }
             .chartYAxis {