Ivan Valkou 5 лет назад
Родитель
Сommit
5cf740acbd

+ 1 - 1
FreeAPS/Resources/Info.plist

@@ -17,7 +17,7 @@
 	<key>CFBundleShortVersionString</key>
 	<string>$(MARKETING_VERSION)</string>
 	<key>CFBundleVersion</key>
-	<string>242</string>
+	<string>243</string>
 	<key>LSApplicationQueriesSchemes</key>
 	<array>
 		<string>dexcomg6</string>

+ 4 - 4
FreeAPS/Sources/Modules/Home/View/Chart/MainChartView.swift

@@ -30,7 +30,7 @@ struct MainChartView: View {
         static let bolusSize: CGFloat = 8
         static let bolusScale: CGFloat = 3
         static let carbsSize: CGFloat = 10
-        static let carbsScale: CGFloat = 0.5
+        static let carbsScale: CGFloat = 0.3
     }
 
     @Binding var glucose: [BloodGlucose]
@@ -104,10 +104,11 @@ struct MainChartView: View {
         ScrollView(.horizontal, showsIndicators: false) {
             ScrollViewReader { scroll in
                 ZStack(alignment: .top) {
-                    tempTargetsView(fullSize: fullSize)
-                    basalView(fullSize: fullSize)
+                    tempTargetsView(fullSize: fullSize).drawingGroup()
+                    basalView(fullSize: fullSize).drawingGroup()
 
                     mainView(fullSize: fullSize).id(Config.endID)
+                        .drawingGroup()
                         .onChange(of: glucose) { _ in
                             scroll.scrollTo(Config.endID, anchor: .trailing)
                         }
@@ -161,7 +162,6 @@ struct MainChartView: View {
             tempBasalPath.stroke(Color.tempBasal, lineWidth: 1)
             regularBasalPath.stroke(Color.basal, lineWidth: 1)
         }
-        .drawingGroup()
         .frame(width: fullGlucoseWidth(viewWidth: fullSize.width) + additionalWidth(viewWidth: fullSize.width))
         .frame(maxHeight: Config.basalHeight)
         .background(Color.secondary.opacity(0.1))

+ 27 - 0
FreeAPS/Sources/Modules/Home/View/HomeRootView.swift

@@ -87,6 +87,32 @@ extension Home {
             .frame(maxWidth: .infinity, maxHeight: 30)
         }
 
+        var legendPanal: some View {
+            HStack(alignment: .firstTextBaseline) {
+                Circle().fill(Color.loopGreen).frame(width: 8, height: 8)
+                    .padding(.leading, 8)
+                Text("BG")
+                    .font(.system(size: 12, weight: .bold)).foregroundColor(.loopGreen)
+                Circle().fill(Color.insulin).frame(width: 8, height: 8)
+                    .padding(.leading, 8)
+                Text("IOB")
+                    .font(.system(size: 12, weight: .bold)).foregroundColor(.insulin)
+                Circle().fill(Color.zt).frame(width: 8, height: 8)
+                    .padding(.leading, 8)
+                Text("ZT")
+                    .font(.system(size: 12, weight: .bold)).foregroundColor(.zt)
+                Circle().fill(Color.loopYellow).frame(width: 8, height: 8)
+                    .padding(.leading, 8)
+                Text("COB")
+                    .font(.system(size: 12, weight: .bold)).foregroundColor(.loopYellow)
+                Circle().fill(Color.uam).frame(width: 8, height: 8)
+                    .padding(.leading, 8)
+                Text("UAM")
+                    .font(.system(size: 12, weight: .bold)).foregroundColor(.uam)
+            }
+            .frame(maxWidth: .infinity, maxHeight: 30)
+        }
+
         var body: some View {
             GeometryReader { geo in
                 VStack(spacing: 0) {
@@ -109,6 +135,7 @@ extension Home {
                         units: viewModel.units
                     )
                     .padding(.bottom)
+                    legendPanal
 
                     ZStack {
                         Rectangle().fill(Color.gray.opacity(0.2)).frame(height: 50 + geo.safeAreaInsets.bottom)