Browse Source

Squashed commit of the following:

commit fff6f73b3a89adfa25405cfaf0a952f8d44810ea
Merge: a790ba4f2 e1b750967
Author: Mike Plante <82073483+MikePlante1@users.noreply.github.com>
Date:   Thu Oct 23 12:14:29 2025 -0400

    Merge branch 'dev' into fix/live-activity-mmol-color-issue-537

commit a790ba4f27100b5e0bca2914b98cdf859c7c7779
Merge: dd4a00ce9 3ba02e017
Author: Mike Plante <82073483+MikePlante1@users.noreply.github.com>
Date:   Fri Oct 17 11:03:00 2025 -0400

    Merge branch 'dev' into fix/live-activity-mmol-color-issue-537

commit dd4a00ce90e720bef5f9d86b850bd0d5b3276254
Merge: 1d8f44c23 132d0f3ce
Author: Sjoerd Bozon <sjoerd.bozon@gmail.com>
Date:   Sat Jul 5 17:55:49 2025 +0200

    Merge branch 'dev' into fix/live-activity-mmol-color-issue-537

commit 1d8f44c23133263c8da6ac85de12a21bd9eb88de
Author: Sjoerd Bozon <sjoerd.bozon@gmail.com>
Date:   Sat Jul 5 17:55:15 2025 +0200

    fix: Live Activity color calculation for MMOL units with static color scheme

    When using MMOL units with a static color scheme, the Live Activity was comparing
    MMOL glucose values against mg/dL thresholds, resulting in incorrect colors being
    displayed. Fixed by properly converting high and low glucose thresholds from mg/dL
    to mmol/L when using MMOL units.

    Fixes #537

commit 94f66d2b4ad8e0c2c49deec9d26b337c4e13d393
Merge: 0cc6385fb 5c7893873
Author: Sjoerd Bozon <sjoerd.bozon@gmail.com>
Date:   Tue Jun 3 08:14:35 2025 +0200

    Merge branch 'dev' into fix/live-activity-mmol-color-issue-537

commit 0cc6385fb1e80239c841a06e8c7533b94f465493
Author: Sjoerd Bozon <sjoerd.bozon@gmail.com>
Date:   Wed May 28 00:27:37 2025 +0200

    fix: Live Activity color calculation for MMOL units with static color scheme

    When using MMOL units with a static color scheme, the high and low glucose
    thresholds were not being converted from mg/dL to mmol/L, causing incorrect
    color display in Live Activities.

    This fix ensures that highGlucose and lowGlucose values are properly
    converted based on the selected unit when using static color scheme.

    Fixes #537
bastiaanv 6 months ago
parent
commit
612791d6e2
1 changed files with 2 additions and 2 deletions
  1. 2 2
      LiveActivity/Views/LiveActivityView.swift

+ 2 - 2
LiveActivity/Views/LiveActivityView.swift

@@ -23,8 +23,8 @@ struct LiveActivityView: View {
 
         return Color.getDynamicGlucoseColor(
             glucoseValue: Decimal(string: state.bg) ?? 100,
-            highGlucoseColorValue: !hasStaticColorScheme ? hardCodedHigh : state.highGlucose,
-            lowGlucoseColorValue: !hasStaticColorScheme ? hardCodedLow : state.lowGlucose,
+            highGlucoseColorValue: !hasStaticColorScheme ? hardCodedHigh : (isMgdL ? state.highGlucose : state.highGlucose.asMmolL),
+            lowGlucoseColorValue: !hasStaticColorScheme ? hardCodedLow : (isMgdL ? state.lowGlucose : state.lowGlucose.asMmolL),
             targetGlucose: isMgdL ? state.target : state.target.asMmolL,
             glucoseColorScheme: state.glucoseColorScheme
         )