Bläddra i källkod

Fix missing vars in DefinitionRow struct; fix list/scroll background in light mode

polscm32 aka Marvout 1 år sedan
förälder
incheckning
e9302960fe

+ 3 - 2
FreeAPS/Sources/Modules/Home/View/Chart/ChartLegendView.swift

@@ -32,7 +32,7 @@ struct ChartLegendView: View {
                         } else {
                             legendConeOfUncertaintyView
                         }
-                    }
+                    }.listRowBackground(Color.gray.opacity(0.1))
 
                     VStack(alignment: .leading) {
                         Text("Other Elements & Shapes").bold().padding(.bottom, 5).textCase(.uppercase)
@@ -114,8 +114,9 @@ struct ChartLegendView: View {
                             color: Color.orange.opacity(0.8),
                             iconString: "line.diagonal"
                         )
-                    }
+                    }.listRowBackground(Color.gray.opacity(0.1))
                 }
+                .scrollContentBackground(.hidden)
                 .navigationBarTitle("Chart Legend", displayMode: .inline)
                 .padding(.trailing, 10)
                 .padding(.bottom, 15)

+ 2 - 2
FreeAPS/Sources/Services/Network/Nightscout/NightscoutManager.swift

@@ -445,7 +445,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
         var modifiedSuggestedDetermination = fetchedSuggestedDetermination
         if var suggestion = fetchedSuggestedDetermination {
             suggestion.timestamp = suggestion.deliverAt
-            
+
             if settingsManager.settings.units == .mmolL {
                 suggestion.reason = parseReasonGlucoseValuesToMmolL(suggestion.reason)
                 // TODO: verify that these parsings are needed for 3rd party apps, e.g., LoopFollow
@@ -1152,7 +1152,7 @@ extension BaseNightscoutManager {
      - Glucose tags handled: `ISF:`, `Target:`, `minPredBG`, `minGuardBG`, `IOBpredBG`, `COBpredBG`, `UAMpredBG`, `Dev:`, `maxDelta`, `BGI`.
      */
 
-     //TODO: Consolidate all mmol parsing methods (in TagCloudView, NightscoutManager and HomeRootView) to one central func
+    // TODO: Consolidate all mmol parsing methods (in TagCloudView, NightscoutManager and HomeRootView) to one central func
     func parseReasonGlucoseValuesToMmolL(_ reason: String) -> String {
         let patterns = [
             "ISF:\\s*-?\\d+\\.?\\d*→-?\\d+\\.?\\d*",

+ 26 - 1
FreeAPS/Sources/Views/DefinitionRow.swift

@@ -6,12 +6,37 @@ struct DefinitionRow<DefinitionView: View>: View {
     var definition: DefinitionView
     var color: Color?
     var fontSize: Font?
+    var iconString: String?
+    var shouldRotateIcon: Bool?
+
+    init(
+        term: String,
+        definition: DefinitionView,
+        color: Color? = nil,
+        fontSize: Font? = nil,
+        iconString: String? = nil,
+        shouldRotateIcon: Bool = false
+    ) {
+        self.term = term
+        self.definition = definition
+        self.color = color
+        self.fontSize = fontSize
+        self.iconString = iconString
+        self.shouldRotateIcon = shouldRotateIcon
+    }
 
     var body: some View {
         VStack(alignment: .leading) {
             HStack {
                 if let color = color {
-                    Image(systemName: "circle.fill").foregroundStyle(color)
+                    if let iconString = iconString {
+                        Image(systemName: iconString)
+                            .foregroundStyle(color)
+                            .rotationEffect(shouldRotateIcon == true ? .degrees(180) : .degrees(0))
+                    } else {
+                        Image(systemName: "circle.fill")
+                            .foregroundStyle(color)
+                    }
                 }
                 Text(term).font(fontSize ?? .subheadline).fontWeight(.semibold)
             }.padding(.bottom, 5)

+ 2 - 18
FreeAPS/Sources/Views/SettingInputHintView.swift

@@ -7,24 +7,6 @@ struct SettingInputHintView<HintView: View>: View {
     var hintText: HintView
     var sheetTitle: String
 
-    @Environment(\.colorScheme) private var colorScheme
-    private var color: LinearGradient {
-        colorScheme == .dark ? LinearGradient(
-            gradient: Gradient(colors: [
-                Color.bgDarkBlue,
-                Color.bgDarkerDarkBlue
-            ]),
-            startPoint: .top,
-            endPoint: .bottom
-        )
-            :
-            LinearGradient(
-                gradient: Gradient(colors: [Color.gray.opacity(0.1)]),
-                startPoint: .top,
-                endPoint: .bottom
-            )
-    }
-
     var body: some View {
         NavigationStack {
             List {
@@ -33,7 +15,9 @@ struct SettingInputHintView<HintView: View>: View {
                     definition: hintText,
                     fontSize: .body
                 )
+                .listRowBackground(Color.gray.opacity(0.1))
             }
+            .scrollContentBackground(.hidden)
             .navigationBarTitle(sheetTitle, displayMode: .inline)
 
             Spacer()

+ 1 - 1
FreeAPS/Sources/Views/TagCloudView.swift

@@ -104,7 +104,7 @@ struct TagCloudView: View {
      - Glucose tags handled: `ISF:`, `Target:`, `minPredBG`, `minGuardBG`, `IOBpredBG`, `COBpredBG`, `UAMpredBG`, `Dev:`, `maxDelta`, `BGI`.
      */
 
-     //TODO: Consolidate all mmol parsing methods (in TagCloudView, NightscoutManager and HomeRootView) to one central func
+    // TODO: Consolidate all mmol parsing methods (in TagCloudView, NightscoutManager and HomeRootView) to one central func
     private func formatGlucoseTags(_ tag: String, isMmolL: Bool) -> String {
         let patterns = [
             "ISF:\\s*-?\\d+\\.?\\d*→-?\\d+\\.?\\d*",