Jon Mårtensson 2 лет назад
Родитель
Сommit
6e1eefa2db

+ 2 - 0
FreeAPS/Sources/Modules/PreferencesEditor/PreferencesEditorStateModel.swift

@@ -9,10 +9,12 @@ extension PreferencesEditor {
         @Published var skipBolusScreenAfterCarbs = false
         @Published var sections: [FieldSection] = []
         @Published var useAlternativeBolusCalc: Bool = false
+        @Published var units: GlucoseUnits = .mmolL
 
         override func subscribe() {
             preferences = provider.preferences
             useAlternativeBolusCalc = settingsManager.settings.useCalc
+            units = settingsManager.settings.units
             subscribeSetting(\.allowAnnouncements, on: $allowAnnouncements) { allowAnnouncements = $0 }
             subscribeSetting(\.insulinReqPercentage, on: $insulinReqPercentage) { insulinReqPercentage = $0 }
 

+ 22 - 16
FreeAPS/Sources/Modules/Settings/View/SettingsRootView.swift

@@ -10,43 +10,49 @@ extension Settings {
 
         var body: some View {
             Form {
-                Section(
-                    header: Text(
+                Section {
+                    Toggle("Closed loop", isOn: $state.closedLoop)
+                } header: {
+                    Text(
                         "iAPS v\(state.versionNumber) (\(state.buildNumber))\nBranch: \(state.branch) \(state.copyrightNotice) "
                     ).textCase(nil)
-                ) {
-                    Toggle("Closed loop", isOn: $state.closedLoop)
                 }
 
-                Section(header: Text("Devices")) {
+                Section {
                     Text("Pump").navigationLink(to: .pumpConfig, from: self)
                     Text("CGM").navigationLink(to: .cgm, from: self)
                     Text("Watch").navigationLink(to: .watch, from: self)
-                }
+                } header: { Text("Devices") }
 
-                Section(header: Text("Services")) {
+                Section {
                     Text("Nightscout").navigationLink(to: .nighscoutConfig, from: self)
                     if HKHealthStore.isHealthDataAvailable() {
                         Text("Apple Health").navigationLink(to: .healthkit, from: self)
                     }
                     Text("Notifications").navigationLink(to: .notificationsConfig, from: self)
-                    Text("Fat And Protein Conversion").navigationLink(to: .fpuConfig, from: self)
-                    Text("App Icons").navigationLink(to: .iconConfig, from: self)
-                    Text("UI/UX Settings").navigationLink(to: .statisticsConfig, from: self)
-                }
+                } header: { Text("Services") }
 
-                Section(header: Text("Configuration")) {
-                    Text("Preferences").navigationLink(to: .preferencesEditor, from: self)
+                Section {
                     Text("Pump Settings").navigationLink(to: .pumpSettingsEditor, from: self)
                     Text("Basal Profile").navigationLink(to: .basalProfileEditor, from: self)
                     Text("Insulin Sensitivities").navigationLink(to: .isfEditor, from: self)
                     Text("Carb Ratios").navigationLink(to: .crEditor, from: self)
                     Text("Target Glucose").navigationLink(to: .targetsEditor, from: self)
+                } header: { Text("Configuration") }
+
+                Section {
+                    Text("OpenAPS").navigationLink(to: .preferencesEditor, from: self)
                     Text("Autotune").navigationLink(to: .autotuneConfig, from: self)
+                } header: { Text("OpenAPS") }
+
+                Section {
+                    Text("UI/UX").navigationLink(to: .statisticsConfig, from: self)
+                    Text("App Icons").navigationLink(to: .iconConfig, from: self)
                     Text("Bolus Calculator").navigationLink(to: .bolusCalculatorConfig, from: self)
-                }
+                    Text("Fat And Protein Conversion").navigationLink(to: .fpuConfig, from: self)
+                } header: { Text("Extra Features") }
 
-                Section(header: Text("Developer")) {
+                Section {
                     Toggle("Debug options", isOn: $state.debugOptions)
                     if state.debugOptions {
                         Group {
@@ -108,7 +114,7 @@ extension Settings {
                                 .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.settings), from: self)
                         }
                     }
-                }
+                } header: { Text("Developer") }
 
                 Section {
                     Toggle("Animated Background", isOn: $state.animatedBackground)

+ 0 - 1
FreeAPS/Sources/Modules/StatConfig/StatConfigStateModel.swift

@@ -12,7 +12,6 @@ extension StatConfig {
         @Published var rulerMarks: Bool = false
         @Published var skipBolusScreenAfterCarbs: Bool = false
         @Published var useFPUconversion: Bool = true
-
         var units: GlucoseUnits = .mmolL
 
         override func subscribe() {

+ 1 - 1
FreeAPS/Sources/Modules/StatConfig/View/StatConfigRootView.swift

@@ -52,7 +52,7 @@ extension StatConfig {
                         DecimalTextField("0", value: $state.high, formatter: glucoseFormatter)
                         Text(state.units.rawValue).foregroundColor(.secondary)
                     }
-                    Toggle("Change HbA1c Unit", isOn: $state.overrideHbA1cUnit)
+                    Toggle("Override HbA1c Unit", isOn: $state.overrideHbA1cUnit)
 
                 } header: { Text("Statistics settings ") }