Просмотр исходного кода

cleanup so it builds and apply linting

Mike Plante 1 год назад
Родитель
Сommit
337f0bd92c

+ 28 - 29
FreeAPS/Sources/Modules/AlgorithmAdvancedSettings/View/AlgorithmAdvancedSettingsRootView.swift

@@ -250,33 +250,32 @@ extension AlgorithmAdvancedSettings {
                     }
                     }
                 )
                 )
 
 
-                
-                //Commenting out Autotune from Settings Menu until full removal is complete
-                //SettingInputSection(
-                    //decimalValue: $state.autotuneISFAdjustmentFraction,
-                    //booleanValue: $booleanPlaceholder,
-                    //shouldDisplayHint: $shouldDisplayHint,
-                    //selectedVerboseHint: Binding(
-                        //get: { selectedVerboseHint },
-                        //set: {
-                            //selectedVerboseHint = $0.map { AnyView($0) }
-                            //hintLabel = NSLocalizedString(
-                                //"Autotune ISF Adjustment Percent",
-                                //comment: "Autotune ISF Adjustment Percent"
-                            //)
-                        //}
-                    //),
-                    //units: state.units,
-                    //type: .decimal("autotuneISFAdjustmentFraction"),
-                    //label: NSLocalizedString("Autotune ISF Adjustment Percent", comment: "Autotune ISF Adjustment Percent"),
-                    //miniHint: "Using Autotune is not advised",
-                    //verboseHint: Text(
-                        //NSLocalizedString(
-                            //"The default of 50% for this value keeps autotune ISF closer to pump ISF via a weighted average of fullNewISF and pumpISF. 100% allows full adjustment, 0% is no adjustment from pump ISF.",
-                            //comment: "Autotune ISF Adjustment Percent"
-                        //)
-                    //)
-                //)
+                // Commenting out Autotune from Settings Menu until full removal is complete
+                // SettingInputSection(
+                // decimalValue: $state.autotuneISFAdjustmentFraction,
+                // booleanValue: $booleanPlaceholder,
+                // shouldDisplayHint: $shouldDisplayHint,
+                // selectedVerboseHint: Binding(
+                // get: { selectedVerboseHint },
+                // set: {
+                // selectedVerboseHint = $0.map { AnyView($0) }
+                // hintLabel = NSLocalizedString(
+                // "Autotune ISF Adjustment Percent",
+                // comment: "Autotune ISF Adjustment Percent"
+                // )
+                // }
+                // ),
+                // units: state.units,
+                // type: .decimal("autotuneISFAdjustmentFraction"),
+                // label: NSLocalizedString("Autotune ISF Adjustment Percent", comment: "Autotune ISF Adjustment Percent"),
+                // miniHint: "Using Autotune is not advised",
+                // verboseHint: Text(
+                // NSLocalizedString(
+                // "The default of 50% for this value keeps autotune ISF closer to pump ISF via a weighted average of fullNewISF and pumpISF. 100% allows full adjustment, 0% is no adjustment from pump ISF.",
+                // comment: "Autotune ISF Adjustment Percent"
+                // )
+                // )
+                // )
 
 
                 SettingInputSection(
                 SettingInputSection(
                     decimalValue: $state.min5mCarbimpact,
                     decimalValue: $state.min5mCarbimpact,
@@ -289,13 +288,13 @@ extension AlgorithmAdvancedSettings {
                             hintLabel = NSLocalizedString("Min 5m Carb Impact", comment: "Min 5m Carb Impact")
                             hintLabel = NSLocalizedString("Min 5m Carb Impact", comment: "Min 5m Carb Impact")
                         }
                         }
                     ),
                     ),
-                    let myText = (state.units == .mg/dL ? 8 : 8.formmatedAsMmolL) + "Default:" + state.units.rawValue)
                     units: state.units,
                     units: state.units,
                     type: .decimal("min5mCarbimpact"),
                     type: .decimal("min5mCarbimpact"),
                     label: NSLocalizedString("Min 5m Carb Impact", comment: "Min 5m Carb Impact"),
                     label: NSLocalizedString("Min 5m Carb Impact", comment: "Min 5m Carb Impact"),
                     miniHint: "Estimates the impact of carb absorbtion after 5 minutes",
                     miniHint: "Estimates the impact of carb absorbtion after 5 minutes",
                     verboseHint: VStack(spacing: 10) {
                     verboseHint: VStack(spacing: 10) {
-                        Text(myText).bold
+                        //     let myText = (state.units == .mgdL ? 8.description : 8.formmatedAsMmolL) as! String + "Default:" + state.units.rawValue
+                        //     Text(myText).bold
                         VStack(alignment: .leading, spacing: 10) {
                         VStack(alignment: .leading, spacing: 10) {
                             Text(
                             Text(
                                 "Min 5m Carb Impact sets the expected glucose rise from carbs over 5 minutes when absorption isn't obvious from glucose data."
                                 "Min 5m Carb Impact sets the expected glucose rise from carbs over 5 minutes when absorption isn't obvious from glucose data."

+ 206 - 207
FreeAPS/Sources/Modules/AutotuneConfig/View/AutotuneConfigRootView.swift

@@ -1,215 +1,214 @@
-//Commenting out Autotune from Settings Menu until full removal is complete
-//import SwiftUI
-//import Swinject
-//
-//extension AutotuneConfig {
-    //struct RootView: BaseView {
-        //let resolver: Resolver
-        //@StateObject var state = StateModel()
-//
-        //@State private var shouldDisplayHint: Bool = false
-        //@State var hintDetent = PresentationDetent.large
-        //@State var selectedVerboseHint: AnyView?
-        //@State var hintLabel: String?
-        //@State private var decimalPlaceholder: Decimal = 0.0
-        //@State private var booleanPlaceholder: Bool = false
-//
-        //@State var replaceAlert = false
-//
-        //@Environment(\.colorScheme) var colorScheme
-        //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
-                //)
-        //}
+import SwiftUI
+import Swinject
 
 
-        //private var isfFormatter: NumberFormatter {
-            //let formatter = NumberFormatter()
-            //formatter.numberStyle = .decimal
-            //formatter.maximumFractionDigits = 2
-            //return formatter
-        //}
+extension AutotuneConfig {
+    struct RootView: BaseView {
+        let resolver: Resolver
+        @StateObject var state = StateModel()
 
 
-        //private var rateFormatter: NumberFormatter {
-            //let formatter = NumberFormatter()
-            //formatter.numberStyle = .decimal
-            //formatter.maximumFractionDigits = 2
-            //return formatter
-        //}
+        @State private var shouldDisplayHint: Bool = false
+        @State var hintDetent = PresentationDetent.large
+        @State var selectedVerboseHint: AnyView?
+        @State var hintLabel: String?
+        @State private var decimalPlaceholder: Decimal = 0.0
+        @State private var booleanPlaceholder: Bool = false
 
 
-        //private var dateFormatter: DateFormatter {
-            //let formatter = DateFormatter()
-            //formatter.dateStyle = .medium
-            //formatter.timeStyle = .short
-            //return formatter
-        //}
+        @State var replaceAlert = false
 
 
-        //var body: some View {
-            //Form {
-                //SettingInputSection(
-                    //decimalValue: $decimalPlaceholder,
-                    //booleanValue: $state.useAutotune,
-                    //shouldDisplayHint: $shouldDisplayHint,
-                    //selectedVerboseHint: Binding(
-                        //get: { selectedVerboseHint },
-                        //set: {
-                            //selectedVerboseHint = $0.map { AnyView($0) }
-                            //hintLabel = "Use Autotune"
-                        //}
-                    //),
-                    //units: state.units,
-                    //type: .boolean,
-                    //label: "Use Autotune",
-                    //miniHint: "It is not advised to use Autotune with Trio",
-                    //verboseHint: VStack(spacing: 10) {
-                        //Text("Default: OFF").bold()
-                        //VStack(alignment: .leading, spacing: 10) {
-                            //Text("It is not advised to use Autotune with Trio").bold()
-                            //Text("Autotune is not designed to work with Trio. It is best to keep Autotune off and do not use it.")
-                        //}
-                    //},
-                    //headerText: "Data-driven Adjustments"
-                //)
-//
-                //if state.useAutotune {
-                    //SettingInputSection(
-                        //decimalValue: $decimalPlaceholder,
-                        //booleanValue: $state.onlyAutotuneBasals,
-                        //shouldDisplayHint: $shouldDisplayHint,
-                        //selectedVerboseHint: Binding(
-                            //get: { selectedVerboseHint },
-                            //set: {
-                                //selectedVerboseHint = $0.map { AnyView($0) }
-                                //hintLabel = "Only Autotune Basal Insulin"
-                            //}
-                        //),
-                        //units: state.units,
-                        //type: .boolean,
-                        //label: "Only Autotune Basal Insulin",
-                        //miniHint: "Restricts Autotune adjustments to only basal settings",
-                        //verboseHint: Text("Restricts Autotune adjustments to only basal settings.")
-                    //)
-                //}
+        @Environment(\.colorScheme) var colorScheme
+        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
+                )
+        }
 
 
-                //Section(
-                    //header: HStack {
-                        //Text("Last run")
-                        //Spacer()
-                        //Text(dateFormatter.string(from: state.publishedDate))
-                    //},
-                    //content: {
-                        //Button {
-                            //state.run()
-                        //} label: {
-                            //Text("Run now")
-                        //}
-                        //.frame(maxWidth: .infinity, alignment: .center)
-                        //.listRowBackground(Color(.systemBlue))
-                        //.tint(.white)
-                    //}
-                //)
-//
-                //if let autotune = state.autotune {
-                    //if !state.onlyAutotuneBasals {
-                        //Section {
-                            //HStack {
-                                //Text("Carb ratio")
-                                //Spacer()
-                                //Text(isfFormatter.string(from: autotune.carbRatio as NSNumber) ?? "0")
-                                //Text("g/U").foregroundColor(.secondary)
-                            //}
-                            //HStack {
-                                //Text("Sensitivity")
-                                //Spacer()
-                                //if state.units == .mmolL {
-                                    //Text(isfFormatter.string(from: autotune.sensitivity.asMmolL as NSNumber) ?? "0")
-                                //} else {
-                                    //Text(isfFormatter.string(from: autotune.sensitivity as NSNumber) ?? "0")
-                                //}
-                                //Text(state.units.rawValue + "/U").foregroundColor(.secondary)
-                            //}
-                        //}
-                        //.listRowBackground(Color.chart)
-                    //}
-//
-                    //Section(header: Text("Basal profile")) {
-                        //ForEach(0 ..< autotune.basalProfile.count, id: \.self) { index in
-                            //HStack {
-                                //Text(autotune.basalProfile[index].start).foregroundColor(.secondary)
-                                //Spacer()
-                                //Text(rateFormatter.string(from: autotune.basalProfile[index].rate as NSNumber) ?? "0")
-                                //Text("U/hr").foregroundColor(.secondary)
-                            //}
-                        //}
-                        //HStack {
-                            //Text("Total")
-                                //.bold()
-                                //.foregroundColor(.primary)
-                            //Spacer()
-                            //Text(rateFormatter.string(from: autotune.basalProfile.reduce(0) { $0 + $1.rate } as NSNumber) ?? "0")
-                                //.foregroundColor(.primary) +
-                                //Text(" U/day")
-                                //.foregroundColor(.secondary)
-                        //}
-                    //}
-                    //.listRowBackground(Color.chart)
+        private var isfFormatter: NumberFormatter {
+            let formatter = NumberFormatter()
+            formatter.numberStyle = .decimal
+            formatter.maximumFractionDigits = 2
+            return formatter
+        }
 
 
-                    //Section {
-                        //Button {
-                            //Task {
-                                //await state.delete()
-                            //}
-                        //} label: {
-                            //Text("Delete Autotune Data")
-                        //}
-                        //.frame(maxWidth: .infinity, alignment: .center)
-                        //.listRowBackground(Color(.loopRed))
-                        //.tint(.white)
+        private var rateFormatter: NumberFormatter {
+            let formatter = NumberFormatter()
+            formatter.numberStyle = .decimal
+            formatter.maximumFractionDigits = 2
+            return formatter
+        }
+
+        private var dateFormatter: DateFormatter {
+            let formatter = DateFormatter()
+            formatter.dateStyle = .medium
+            formatter.timeStyle = .short
+            return formatter
+        }
+
+        var body: some View {
+            Form {
+                SettingInputSection(
+                    decimalValue: $decimalPlaceholder,
+                    booleanValue: $state.useAutotune,
+                    shouldDisplayHint: $shouldDisplayHint,
+                    selectedVerboseHint: Binding(
+                        get: { selectedVerboseHint },
+                        set: {
+                            selectedVerboseHint = $0.map { AnyView($0) }
+                            hintLabel = "Use Autotune"
+                        }
+                    ),
+                    units: state.units,
+                    type: .boolean,
+                    label: "Use Autotune",
+                    miniHint: "It is not advised to use Autotune with Trio",
+                    verboseHint: VStack(spacing: 10) {
+                        Text("Default: OFF").bold()
+                        VStack(alignment: .leading, spacing: 10) {
+                            Text("It is not advised to use Autotune with Trio").bold()
+                            Text("Autotune is not designed to work with Trio. It is best to keep Autotune off and do not use it.")
+                        }
+                    },
+                    headerText: "Data-driven Adjustments"
+                )
+
+                if state.useAutotune {
+                    SettingInputSection(
+                        decimalValue: $decimalPlaceholder,
+                        booleanValue: $state.onlyAutotuneBasals,
+                        shouldDisplayHint: $shouldDisplayHint,
+                        selectedVerboseHint: Binding(
+                            get: { selectedVerboseHint },
+                            set: {
+                                selectedVerboseHint = $0.map { AnyView($0) }
+                                hintLabel = "Only Autotune Basal Insulin"
+                            }
+                        ),
+                        units: state.units,
+                        type: .boolean,
+                        label: "Only Autotune Basal Insulin",
+                        miniHint: "Restricts Autotune adjustments to only basal settings",
+                        verboseHint: Text("Restricts Autotune adjustments to only basal settings.")
+                    )
+                }
+
+                Section(
+                    header: HStack {
+                        Text("Last run")
+                        Spacer()
+                        Text(dateFormatter.string(from: state.publishedDate))
+                    },
+                    content: {
+                        Button {
+                            state.run()
+                        } label: {
+                            Text("Run now")
+                        }
+                        .frame(maxWidth: .infinity, alignment: .center)
+                        .listRowBackground(Color(.systemBlue))
+                        .tint(.white)
+                    }
+                )
+
+                if let autotune = state.autotune {
+                    if !state.onlyAutotuneBasals {
+                        Section {
+                            HStack {
+                                Text("Carb ratio")
+                                Spacer()
+                                Text(isfFormatter.string(from: autotune.carbRatio as NSNumber) ?? "0")
+                                Text("g/U").foregroundColor(.secondary)
+                            }
+                            HStack {
+                                Text("Sensitivity")
+                                Spacer()
+                                if state.units == .mmolL {
+                                    Text(isfFormatter.string(from: autotune.sensitivity.asMmolL as NSNumber) ?? "0")
+                                } else {
+                                    Text(isfFormatter.string(from: autotune.sensitivity as NSNumber) ?? "0")
+                                }
+                                Text(state.units.rawValue + "/U").foregroundColor(.secondary)
+                            }
+                        }
+                        .listRowBackground(Color.chart)
                     }
                     }
 
 
-                    // Section {
-                    //     Button {
-                    //         replaceAlert = true
-                    //     } label: {
-                    //         Text("Save as Normal Basal Rates")
-                    //     }
-                    //     .frame(maxWidth: .infinity, alignment: .center)
-                    //     .listRowBackground(Color(.systemGray4))
-                    //     .tint(.white)
-                    // }
-                //}
-            //}
-            //.sheet(isPresented: $shouldDisplayHint) {
-                //SettingInputHintView(
-                    //hintDetent: $hintDetent,
-                    //shouldDisplayHint: $shouldDisplayHint,
-                    //hintLabel: hintLabel ?? "",
-                    //hintText: selectedVerboseHint ?? AnyView(EmptyView()),
-                    //sheetTitle: "Help"
-                //)
-            //}
-            //.scrollContentBackground(.hidden).background(color)
-            //.onAppear(perform: configureView)
-            //.navigationTitle("Autotune")
-            //.navigationBarTitleDisplayMode(.automatic)
-            //.alert(Text("Are you sure?"), isPresented: $replaceAlert) {
-                //Button("Yes", action: {
-                    //state.replace()
-                    //replaceAlert.toggle()
-                //})
-                //Button("No", action: { replaceAlert.toggle() })
-            //}
-        //}
-    //}
-//}
+                    Section(header: Text("Basal profile")) {
+                        ForEach(0 ..< autotune.basalProfile.count, id: \.self) { index in
+                            HStack {
+                                Text(autotune.basalProfile[index].start).foregroundColor(.secondary)
+                                Spacer()
+                                Text(rateFormatter.string(from: autotune.basalProfile[index].rate as NSNumber) ?? "0")
+                                Text("U/hr").foregroundColor(.secondary)
+                            }
+                        }
+                        HStack {
+                            Text("Total")
+                                .bold()
+                                .foregroundColor(.primary)
+                            Spacer()
+                            Text(rateFormatter.string(from: autotune.basalProfile.reduce(0) { $0 + $1.rate } as NSNumber) ?? "0")
+                                .foregroundColor(.primary) +
+                                Text(" U/day")
+                                .foregroundColor(.secondary)
+                        }
+                    }
+                    .listRowBackground(Color.chart)
+
+                    Section {
+                        Button {
+                            Task {
+                                await state.delete()
+                            }
+                        } label: {
+                            Text("Delete Autotune Data")
+                        }
+                        .frame(maxWidth: .infinity, alignment: .center)
+                        .listRowBackground(Color(.loopRed))
+                        .tint(.white)
+                    }
+
+                    Section {
+                        Button {
+                            replaceAlert = true
+                        } label: {
+                            Text("Save as Normal Basal Rates")
+                        }
+                        .frame(maxWidth: .infinity, alignment: .center)
+                        .listRowBackground(Color(.systemGray4))
+                        .tint(.white)
+                    }
+                }
+            }
+            .sheet(isPresented: $shouldDisplayHint) {
+                SettingInputHintView(
+                    hintDetent: $hintDetent,
+                    shouldDisplayHint: $shouldDisplayHint,
+                    hintLabel: hintLabel ?? "",
+                    hintText: selectedVerboseHint ?? AnyView(EmptyView()),
+                    sheetTitle: "Help"
+                )
+            }
+            .scrollContentBackground(.hidden).background(color)
+            .onAppear(perform: configureView)
+            .navigationTitle("Autotune")
+            .navigationBarTitleDisplayMode(.automatic)
+            .alert(Text("Are you sure?"), isPresented: $replaceAlert) {
+                Button("Yes", action: {
+                    state.replace()
+                    replaceAlert.toggle()
+                })
+                Button("No", action: { replaceAlert.toggle() })
+            }
+        }
+    }
+}

+ 19 - 7
FreeAPS/Sources/Modules/DynamicSettings/View/DynamicSettingsRootView.swift

@@ -80,8 +80,13 @@ extension DynamicSettings {
                             Text(
                             Text(
                                 "Dynamic ISF produces a Dynamic Ratio, replacing the Autosens Ratio, determining how much your profile ISF will be adjusted every loop cycle, ensuring it stays within safe limits set by your Autosens Min/Max settings. It provides more precise insulin dosing by responding to changes in insulin needs throughout the day."
                                 "Dynamic ISF produces a Dynamic Ratio, replacing the Autosens Ratio, determining how much your profile ISF will be adjusted every loop cycle, ensuring it stays within safe limits set by your Autosens Min/Max settings. It provides more precise insulin dosing by responding to changes in insulin needs throughout the day."
                             )
                             )
-                            Text("You can influence the adjustments made by Dynamic ISF primarily by adjusting Autosens Max, Autosens Min, and Adjustment Factor. Other settings also influence Dynamic ISF's response, such as Target Glucose, Profile ISF, Peak Insulin Time, and Weighted Average of TDD.")
-                            Text("Warning: Before adjusting these settings, make sure you are fully aware of the impact those changes will have.").bold()
+                            Text(
+                                "You can influence the adjustments made by Dynamic ISF primarily by adjusting Autosens Max, Autosens Min, and Adjustment Factor. Other settings also influence Dynamic ISF's response, such as Target Glucose, Profile ISF, Peak Insulin Time, and Weighted Average of TDD."
+                            )
+                            Text(
+                                "Warning: Before adjusting these settings, make sure you are fully aware of the impact those changes will have."
+                            )
+                            .bold()
                         }
                         }
                     },
                     },
                     headerText: "Dynamic Settings"
                     headerText: "Dynamic Settings"
@@ -143,7 +148,9 @@ extension DynamicSettings {
                                 Text(
                                 Text(
                                     "Turning on the Sigmoid Formula setting alters how your Dynamic Ratio, and thus your New ISF and New Carb Ratio, are calculated using a sigmoid curve rather than the default logarithmic function."
                                     "Turning on the Sigmoid Formula setting alters how your Dynamic Ratio, and thus your New ISF and New Carb Ratio, are calculated using a sigmoid curve rather than the default logarithmic function."
                                 )
                                 )
-                                Text("The curve's steepness is influenced by the Adjustment Factor, while the Autosens Min/Max settings determine the limits of the ratio adjustment, which can also influence the steepness of the sigmoid curve.")
+                                Text(
+                                    "The curve's steepness is influenced by the Adjustment Factor, while the Autosens Min/Max settings determine the limits of the ratio adjustment, which can also influence the steepness of the sigmoid curve."
+                                )
                                 Text(
                                 Text(
                                     "When using the Sigmoid Formula, the weighted Total Daily Dose has a much lower impact on the dynamic adjustments to sensitivity."
                                     "When using the Sigmoid Formula, the weighted Total Daily Dose has a much lower impact on the dynamic adjustments to sensitivity."
                                 )
                                 )
@@ -168,7 +175,7 @@ extension DynamicSettings {
                                     hintLabel = "Adjustment Factor (AF)"
                                     hintLabel = "Adjustment Factor (AF)"
                                 }
                                 }
                             ),
                             ),
-                            //TODO?: include conditional links to Desmos logarithmic graphs based on which .glucose setting is used
+                            // TODO?: include conditional links to Desmos logarithmic graphs based on which .glucose setting is used
                             units: state.units,
                             units: state.units,
                             type: .decimal("adjustmentFactor"),
                             type: .decimal("adjustmentFactor"),
                             label: "Adjustment Factor (AF)",
                             label: "Adjustment Factor (AF)",
@@ -211,7 +218,8 @@ extension DynamicSettings {
                                         "The Sigmoid Adjustment Factor (AF) allows you to control how quickly Sigmoid Dynamic ISF responds to changes in glucose levels and at what glucose value you will reach your Autosens Max and Autosens Min limits."
                                         "The Sigmoid Adjustment Factor (AF) allows you to control how quickly Sigmoid Dynamic ISF responds to changes in glucose levels and at what glucose value you will reach your Autosens Max and Autosens Min limits."
                                     )
                                     )
                                     Text(
                                     Text(
-                                        "Sigmoid Adjustment Factor influences both how fast your ISF values will change and how quickly you will reach your Autosens Max and Min limits set. Increasing Sigmoid Adjustment Factor increases the rate of change of your ISF and reduces the range of glucose values between your Autosens Max and Min limits.")
+                                        "Sigmoid Adjustment Factor influences both how fast your ISF values will change and how quickly you will reach your Autosens Max and Min limits set. Increasing Sigmoid Adjustment Factor increases the rate of change of your ISF and reduces the range of glucose values between your Autosens Max and Min limits."
+                                    )
                                     Text(
                                     Text(
                                         "This setting allows for a more responsive system, but the effects are restricted by the Autosens Min/Max settings."
                                         "This setting allows for a more responsive system, but the effects are restricted by the Autosens Min/Max settings."
                                     )
                                     )
@@ -270,10 +278,14 @@ extension DynamicSettings {
                         miniHint: "Use Dynamic Ratio to adjust basal rates",
                         miniHint: "Use Dynamic Ratio to adjust basal rates",
                         verboseHint: VStack(spacing: 10) {
                         verboseHint: VStack(spacing: 10) {
                             Text("Default: OFF").bold()
                             Text("Default: OFF").bold()
-                            Text("Turn this setting on to give basal adjustments more agility. Keep this setting off if your basal needs are not highly variable.")
+                            Text(
+                                "Turn this setting on to give basal adjustments more agility. Keep this setting off if your basal needs are not highly variable."
+                            )
                             Text("Normally, a new basal rate is set by autosens:")
                             Text("Normally, a new basal rate is set by autosens:")
                             Text("New Basal Profile =\n(Current Basal Profile) x (Autosens Ratio)")
                             Text("New Basal Profile =\n(Current Basal Profile) x (Autosens Ratio)")
-                            Text("Adjust Basal replaces the standard Autosens Ratio calculation with its own Autosens Ratio calculated as such:")
+                            Text(
+                                "Adjust Basal replaces the standard Autosens Ratio calculation with its own Autosens Ratio calculated as such:"
+                            )
                             Text("Autosens Ratio =\n(Weighted Average of TDD) ÷ (10-day Average of TDD)")
                             Text("Autosens Ratio =\n(Weighted Average of TDD) ÷ (10-day Average of TDD)")
                             Text("New Basal Profile =\n(Current Basal Profile) × (Autosens Ratio)")
                             Text("New Basal Profile =\n(Current Basal Profile) × (Autosens Ratio)")
                         }
                         }

+ 4 - 1
FreeAPS/Sources/Modules/GeneralSettings/View/UnitsLimitsSettingsRootView.swift

@@ -62,7 +62,10 @@ extension UnitsLimitsSettings {
                     verboseHint: VStack(spacing: 10) {
                     verboseHint: VStack(spacing: 10) {
                         Text("Default: 0 units").bold()
                         Text("Default: 0 units").bold()
                         VStack(alignment: .leading, spacing: 10) {
                         VStack(alignment: .leading, spacing: 10) {
-                            Text("Warning: This must be greater than 0 for any automatic temporary basal rates or SMBs to be given.").bold()
+                            Text(
+                                "Warning: This must be greater than 0 for any automatic temporary basal rates or SMBs to be given."
+                            )
+                            .bold()
                             Text(
                             Text(
                                 "The maximum amount of Insulin On Board (IOB) above profile basal rates from all sources - positive temporary basal rates, manual or meal boluses, and SMBs - that Trio is allowed to accumulate to address a higher-than-target glucose."
                                 "The maximum amount of Insulin On Board (IOB) above profile basal rates from all sources - positive temporary basal rates, manual or meal boluses, and SMBs - that Trio is allowed to accumulate to address a higher-than-target glucose."
                             )
                             )

+ 3 - 1
FreeAPS/Sources/Modules/Home/View/HomeRootView.swift

@@ -788,7 +788,9 @@ extension Home {
                         List {
                         List {
                             DefinitionRow(
                             DefinitionRow(
                                 term: "IOB (Insulin on Board)",
                                 term: "IOB (Insulin on Board)",
-                                definition: Text("Forecasts future glucose readings based on the amount of insulin still active in the body."),
+                                definition: Text(
+                                    "Forecasts future glucose readings based on the amount of insulin still active in the body."
+                                ),
                                 color: .insulin
                                 color: .insulin
                             )
                             )
                             DefinitionRow(
                             DefinitionRow(

+ 13 - 15
FreeAPS/Sources/Modules/NightscoutConfig/View/NightscoutConfigRootView.swift

@@ -65,24 +65,18 @@ extension NightscoutConfig {
                             Button {
                             Button {
                                 importAlert = Alert(
                                 importAlert = Alert(
                                     title: Text("Import Therapy Settings?"),
                                     title: Text("Import Therapy Settings?"),
-                                    message: VStack(spacing: 10) {
-                                        Text("Are you sure you want to import profile settings from Nightscout?")
-                                        Text("This will overwrite the following Trio therapy settings:")
-                                        VStack(alignment: .leading, spacing: 5) {
-                                            Text("• Basal Rates")
-                                            Text("• Insulin Sensitivities")
-                                            Text("• Carb Ratios")
-                                            Text("• Target Glucose")
-                                            Text("• Duration of Insulin Action")
-                                        }
-                                    }
-                                    ),
+                                    message: Text("Are you sure you want to import profile settings from Nightscout?\n\n")
+                                        + Text("This will overwrite the following Trio therapy settings:\n")
+                                        + Text("• Basal Rates\n")
+                                        + Text("• Insulin Sensitivities\n")
+                                        + Text("• Carb Ratios\n")
+                                        + Text("• Target Glucose\n")
+                                        + Text("• Duration of Insulin Action"),
                                     primaryButton: .default(
                                     primaryButton: .default(
                                         Text("Yes, Import!"),
                                         Text("Yes, Import!"),
                                         action: {
                                         action: {
                                             Task {
                                             Task {
                                                 await state.importSettings()
                                                 await state.importSettings()
-                                                // Check the import status and errors after the import process finishes
                                                 if state.importStatus == .failed, state.importErrors.isNotEmpty,
                                                 if state.importStatus == .failed, state.importErrors.isNotEmpty,
                                                    let errorMessage = state.importErrors.first
                                                    let errorMessage = state.importErrors.first
                                                 {
                                                 {
@@ -109,7 +103,9 @@ extension NightscoutConfig {
                                 .disabled(state.url.isEmpty || state.connecting)
                                 .disabled(state.url.isEmpty || state.connecting)
 
 
                             HStack(alignment: .top) {
                             HStack(alignment: .top) {
-                                Text("Import therapy settings from Nightscout\nSee hint for the list of settings available for import")
+                                Text(
+                                    "Import therapy settings from Nightscout\nSee hint for the list of settings available for import"
+                                )
                                 .font(.footnote)
                                 .font(.footnote)
                                 .foregroundColor(.secondary)
                                 .foregroundColor(.secondary)
                                 .lineLimit(nil)
                                 .lineLimit(nil)
@@ -119,7 +115,9 @@ extension NightscoutConfig {
                                         hintLabel = "Import Settings from Nightscout"
                                         hintLabel = "Import Settings from Nightscout"
                                         selectedVerboseHint =
                                         selectedVerboseHint =
                                             AnyView(
                                             AnyView(
-                                                Text("This will overwrite the following Trio therapy settings:\n\n• Basal Rates\n• Insulin Sensitivities\n• Carb Ratios\n• Target Glucose\n• Duration of Insulin Action")
+                                                Text(
+                                                    "This will overwrite the following Trio therapy settings:\n\n• Basal Rates\n• Insulin Sensitivities\n• Carb Ratios\n• Target Glucose\n• Duration of Insulin Action"
+                                                )
                                             )
                                             )
                                         shouldDisplayHint.toggle()
                                         shouldDisplayHint.toggle()
                                     },
                                     },

+ 6 - 1
FreeAPS/Sources/Modules/PumpConfig/View/PumpConfigRootView.swift

@@ -73,7 +73,12 @@ extension PumpConfig {
                                         Button(
                                         Button(
                                             action: {
                                             action: {
                                                 hintLabel = "Pump Pairing to Trio"
                                                 hintLabel = "Pump Pairing to Trio"
-                                                selectedVerboseHint = AnyView(Text("Current Pump Models Supported:\n\n•Medtronic\n•Omnipod Eros\n•Omnipod Dash\n•Pump Simulator\n\nNote: If using a pump simulator, you will not have continuous readings from the CGM in Trio. Using a pump simulator is only advisable for becoming familiar with the app user interface. It will not give you insight on how the algorithm will respond."))
+                                                selectedVerboseHint =
+                                                    AnyView(
+                                                        Text(
+                                                            "Current Pump Models Supported:\n\n•Medtronic\n•Omnipod Eros\n•Omnipod Dash\n•Pump Simulator\n\nNote: If using a pump simulator, you will not have continuous readings from the CGM in Trio. Using a pump simulator is only advisable for becoming familiar with the app user interface. It will not give you insight on how the algorithm will respond."
+                                                        )
+                                                    )
                                                 shouldDisplayHint.toggle()
                                                 shouldDisplayHint.toggle()
                                             },
                                             },
                                             label: {
                                             label: {

+ 3 - 3
FreeAPS/Sources/Modules/Settings/SettingItems.swift

@@ -130,7 +130,7 @@ enum SettingItems {
                 "Unsuspend If No Temp",
                 "Unsuspend If No Temp",
                 "Suspend Zeros IOB",
                 "Suspend Zeros IOB",
                 "Min 5m Carbimpact",
                 "Min 5m Carbimpact",
-                //"Autotune ISF Adjustment Fraction",
+                // "Autotune ISF Adjustment Fraction",
                 "Remaining Carbs Fraction",
                 "Remaining Carbs Fraction",
                 "Remaining Carbs Cap",
                 "Remaining Carbs Cap",
                 "Noisy CGM Target Multiplier"
                 "Noisy CGM Target Multiplier"
@@ -203,8 +203,8 @@ enum SettingItems {
             ],
             ],
             path: ["Features", "User Interface"]
             path: ["Features", "User Interface"]
         ),
         ),
-        SettingItem(title: "App Icons", view: .iconConfig),
-        //SettingItem(title: "Autotune", view: .autotuneConfig)
+        SettingItem(title: "App Icons", view: .iconConfig)
+        // SettingItem(title: "Autotune", view: .autotuneConfig)
     ]
     ]
 
 
     static let notificationItems = [
     static let notificationItems = [

+ 6 - 6
FreeAPS/Sources/Modules/Settings/View/Subviews/FeatureSettingsView.swift

@@ -53,12 +53,12 @@ struct FeatureSettingsView: BaseView {
             )
             )
             .listRowBackground(Color.chart)
             .listRowBackground(Color.chart)
 
 
-            //Section(
-                //header: Text("Data-Driven Settings Tuning"),
-                //content: {
-                    //Text("Autotune").navigationLink(to: .autotuneConfig, from: self)
-                //}
-            //)
+            // Section(
+            // header: Text("Data-Driven Settings Tuning"),
+            // content: {
+            // Text("Autotune").navigationLink(to: .autotuneConfig, from: self)
+            // }
+            // )
             .listRowBackground(Color.chart)
             .listRowBackground(Color.chart)
         }
         }
         .scrollContentBackground(.hidden).background(color)
         .scrollContentBackground(.hidden).background(color)

Разница между файлами не показана из-за своего большого размера
+ 39 - 11
FreeAPS/Sources/Modules/UserInterfaceSettings/View/UserInterfaceSettingsRootView.swift


+ 3 - 1
FreeAPS/Sources/Modules/WatchConfig/View/WatchConfigAppleWatchView.swift

@@ -106,7 +106,9 @@ struct WatchConfigAppleWatchView: View {
                 type: .boolean,
                 type: .boolean,
                 label: "Confirm Bolus Faster",
                 label: "Confirm Bolus Faster",
                 miniHint: "Removes validation for boluses sent from the paired apple watch",
                 miniHint: "Removes validation for boluses sent from the paired apple watch",
-                verboseHint: Text("Enabling this feature removes the confirmation / validation step to initiate a bolus faster from the watch.")
+                verboseHint: Text(
+                    "Enabling this feature removes the confirmation / validation step to initiate a bolus faster from the watch."
+                )
             )
             )
         }
         }
         .sheet(isPresented: $shouldDisplayHint) {
         .sheet(isPresented: $shouldDisplayHint) {