Browse Source

Adjust LA chart scale for override

Deniz Cengiz 1 năm trước cách đây
mục cha
commit
91cded3b48

+ 10 - 5
LiveActivity/LiveActivity.swift

@@ -85,7 +85,7 @@ struct LiveActivity: Widget {
             } compactTrailing: {
                 LiveActivityCompactTrailingView(context: context)
             } minimal: {
-                LiveActivityMinimalView(context: context).font(.caption2)
+                LiveActivityMinimalView(context: context).font(.system(size: 11))
             }
         }
     }
@@ -118,7 +118,7 @@ struct LiveActivityView: View {
                     }
 
                 HStack {
-                    ForEach(context.state.itemOrder, id: \.self) { item in
+                    ForEach(Array(context.state.itemOrder.enumerated()), id: \.element) { index, item in
                         switch item {
                         case "currentGlucose":
                             if context.state.showCurrentGlucose {
@@ -147,7 +147,10 @@ struct LiveActivityView: View {
                         default:
                             EmptyView()
                         }
-                        Divider().foregroundStyle(.primary).fontWeight(.bold).frame(width: 10)
+
+                        if index < context.state.itemOrder.count - 1 {
+                            Divider().foregroundStyle(.primary).fontWeight(.bold).frame(width: 10)
+                        }
                     }
                 }
             }
@@ -324,11 +327,13 @@ struct LiveActivityChartView: View {
             .asMmolL
         let target = additionalState.unit == "mg/dL" ? additionalState.target : additionalState.target.asMmolL
 
+        let isOverrideActive = additionalState.isOverrideActive == true
+
         let calendar = Calendar.current
         let now = Date()
 
         let startDate = calendar.date(byAdding: .hour, value: -6, to: now) ?? now
-        let endDate = calendar.date(byAdding: .hour, value: 2, to: now) ?? now
+        let endDate = isOverrideActive ? (calendar.date(byAdding: .hour, value: 2, to: now) ?? now) : now
 
         Chart {
             RuleMark(y: .value("Low", yAxisRuleMarkMin))
@@ -337,7 +342,7 @@ struct LiveActivityChartView: View {
                 .lineStyle(.init(lineWidth: 0.5, dash: [5]))
             RuleMark(y: .value("Target", target)).foregroundStyle(.green.gradient).lineStyle(.init(lineWidth: 1))
 
-            if context.state.detailedViewState?.isOverrideActive == true {
+            if isOverrideActive {
                 drawActiveOverrides()
             }
 

+ 2 - 56
Trio.xcworkspace/xcshareddata/swiftpm/Package.resolved

@@ -1,5 +1,5 @@
 {
-  "originHash" : "59ac7eba66375d6eb406e758cb0b9964f4b3b0ae45c5665596f00384c32262b9",
+  "originHash" : "cef813f4bbb01679d4ac9bf4a9f82c1a0a61e44dc839643e81aa92e4d00642bc",
   "pins" : [
     {
       "identity" : "cryptoswift",
@@ -11,15 +11,6 @@
       }
     },
     {
-      "identity" : "mkringprogressview",
-      "kind" : "remoteSourceControl",
-      "location" : "https://github.com/maxkonovalov/MKRingProgressView.git",
-      "state" : {
-        "branch" : "master",
-        "revision" : "660888aab1d2ab0ed7eb9eb53caec12af4955fa7"
-      }
-    },
-    {
       "identity" : "slidebutton",
       "kind" : "remoteSourceControl",
       "location" : "https://github.com/no-comment/SlideButton",
@@ -29,60 +20,15 @@
       }
     },
     {
-      "identity" : "swift-algorithms",
-      "kind" : "remoteSourceControl",
-      "location" : "https://github.com/apple/swift-algorithms",
-      "state" : {
-        "revision" : "2327673b0e9c7e90e6b1826376526ec3627210e4",
-        "version" : "0.2.1"
-      }
-    },
-    {
-      "identity" : "swift-numerics",
-      "kind" : "remoteSourceControl",
-      "location" : "https://github.com/apple/swift-numerics",
-      "state" : {
-        "revision" : "6583ac70c326c3ee080c1d42d9ca3361dca816cd",
-        "version" : "0.1.0"
-      }
-    },
-    {
       "identity" : "swiftcharts",
       "kind" : "remoteSourceControl",
-      "location" : "https://github.com/ivanschuetz/SwiftCharts.git",
+      "location" : "https://github.com/ivanschuetz/SwiftCharts",
       "state" : {
         "branch" : "master",
         "revision" : "c354c1945bb35a1f01b665b22474f6db28cba4a2"
       }
     },
     {
-      "identity" : "swiftdate",
-      "kind" : "remoteSourceControl",
-      "location" : "https://github.com/malcommac/SwiftDate",
-      "state" : {
-        "revision" : "6190d0cefff3013e77ed567e6b074f324e5c5bf5",
-        "version" : "6.3.1"
-      }
-    },
-    {
-      "identity" : "swiftmessages",
-      "kind" : "remoteSourceControl",
-      "location" : "https://github.com/SwiftKickMobile/SwiftMessages",
-      "state" : {
-        "revision" : "62e12e138fc3eedf88c7553dd5d98712aa119f40",
-        "version" : "9.0.9"
-      }
-    },
-    {
-      "identity" : "swinject",
-      "kind" : "remoteSourceControl",
-      "location" : "https://github.com/Swinject/Swinject",
-      "state" : {
-        "revision" : "be9dbcc7b86811bc131539a20c6f9c2d3e56919f",
-        "version" : "2.9.1"
-      }
-    },
-    {
       "identity" : "tidepoolkit",
       "kind" : "remoteSourceControl",
       "location" : "https://github.com/tidepool-org/TidepoolKit",