ソースを参照

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 年間 前
コミット
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 {