Browse Source

fix: Clamp forecast Y-axis max to chart threshold in Live Activity widget

Prevents a high COB/UAM prediction from expanding the Y-axis beyond the
existing maxThreshhold (220 on watchOS, 300 on iOS), keeping glucose
values readable on the small lock screen chart.
Magnus Reintz 1 week ago
parent
commit
5cf740f2df

+ 1 - 1
LiveActivity/Views/LiveActivityChartView.swift

@@ -31,7 +31,7 @@ struct LiveActivityChartView: View {
         let chartMin = additionalState.chart.min(by: { $0.value < $1.value })?.value ?? 39
         let chartMax = additionalState.chart.max(by: { $0.value < $1.value })?.value ?? maxThreshhold
         let forecastMin = additionalState.minForecast.min().map { Decimal($0) } ?? chartMin
-        let forecastMax = additionalState.maxForecast.max().map { Decimal($0) } ?? chartMax
+        let forecastMax = min(additionalState.maxForecast.max().map { Decimal($0) } ?? chartMax, maxThreshhold)
         let minValue = min(min(chartMin, forecastMin), 39)
         let maxValue = max(max(chartMax, forecastMax), maxThreshhold)
 

+ 1 - 1
MedtrumKit

@@ -1 +1 @@
-Subproject commit 3ad0979a3c8fc36c2d48a76da8ea70ef2132943a
+Subproject commit 7a3cb276b65ebaee7a3d6485878baa525399c3ee

+ 1 - 1
OmnipodKit

@@ -1 +1 @@
-Subproject commit b5b95562f73e6d3627e3e20ffe31f8d7f6a4639e
+Subproject commit adf210d20bcfc05f8119e8665d8f5904db828e03

+ 17 - 0
Trio/Sources/Localizations/Main/Localizable.xcstrings

@@ -98278,6 +98278,12 @@
         }
       }
     },
+    "Display Glucose Forecasts" : {
+
+    },
+    "Display Glucose Forecasts made by the Oref algorithm." : {
+
+    },
     "Display HR on Watch" : {
       "comment" : "Option to show HR in Watch app",
       "extractionState" : "manual",
@@ -164473,6 +164479,10 @@
         }
       }
     },
+    "Max" : {
+      "comment" : "Y-axis value for the upper bound of a cone.",
+      "isCommentAutoGenerated" : true
+    },
     "Max Allowed Glucose Rise for SMB" : {
       "comment" : "Max Allowed Glucose Rise for SMB, formerly Max Delta-BG Threshold",
       "localizations" : {
@@ -172771,6 +172781,10 @@
         }
       }
     },
+    "Min" : {
+      "comment" : "Y-axis minimum value.",
+      "isCommentAutoGenerated" : true
+    },
     "Min 4 hours, max 10 hours." : {
       "localizations" : {
         "bg" : {
@@ -285150,6 +285164,9 @@
         }
       }
     },
+    "When enabled, the live activity widget on the lock screen will show glucose forecasts. The visual representation will be the same as in the Main view. To change between Cone and Lines, change the setting under Features - User Interface - Forecast Display Type." : {
+
+    },
     "When enabled, Trio will create a customizable calendar event to keep you notified of your current glucose reading with every successful loop cycle." : {
       "localizations" : {
         "bg" : {