Sfoglia il codice sorgente

Settings Refactoring WIP
* Re-order settings root view
* Refactor top section showing branch info and looping state
* Fiddle around with showing some hints and more info (POC Dynamic ISF settings); highly WIP
* WIP

Deniz Cengiz 1 anno fa
parent
commit
01864ebb87

+ 4 - 4
FreeAPS.xcodeproj/project.pbxproj

@@ -316,7 +316,6 @@
 		BF1667ADE69E4B5B111CECAE /* ManualTempBasalProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 680C4420C9A345D46D90D06C /* ManualTempBasalProvider.swift */; };
 		C967DACD3B1E638F8B43BE06 /* ManualTempBasalStateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFCFE0781F9074C2917890E8 /* ManualTempBasalStateModel.swift */; };
 		CA370FC152BC98B3D1832968 /* BasalProfileEditorRootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF8BCB0C37DEB5EC377B9612 /* BasalProfileEditorRootView.swift */; };
-		CC41E29A2B1E1F460070974F /* HistoryLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC41E2992B1E1F460070974F /* HistoryLayout.swift */; };
 		CC6C406E2ACDD69E009B8058 /* RawFetchedProfile.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC6C406D2ACDD69E009B8058 /* RawFetchedProfile.swift */; };
 		CC76E9512BD4812E008BEB61 /* Forecast+helper.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC76E9502BD4812E008BEB61 /* Forecast+helper.swift */; };
 		CD78BB94E43B249D60CC1A1B /* NotificationsConfigRootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22963BD06A9C83959D4914E4 /* NotificationsConfigRootView.swift */; };
@@ -418,6 +417,7 @@
 		DD57C4D22C4C7103001A5B28 /* StatsData+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD57C4B02C4C7103001A5B28 /* StatsData+CoreDataClass.swift */; };
 		DD57C4D32C4C7103001A5B28 /* StatsData+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD57C4B12C4C7103001A5B28 /* StatsData+CoreDataProperties.swift */; };
 		DD68889D2C386E17006E3C44 /* NightscoutExercise.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD68889C2C386E17006E3C44 /* NightscoutExercise.swift */; };
+		DD88C8E22C50420800F2D558 /* DefinitionRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD88C8E12C50420800F2D558 /* DefinitionRow.swift */; };
 		DDD163122C4C689900CD525A /* OverrideStateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD163112C4C689900CD525A /* OverrideStateModel.swift */; };
 		DDD163142C4C68D300CD525A /* OverrideProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD163132C4C68D300CD525A /* OverrideProvider.swift */; };
 		DDD163162C4C690300CD525A /* OverrideDataFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD163152C4C690300CD525A /* OverrideDataFlow.swift */; };
@@ -911,7 +911,6 @@
 		C19984D62EFC0035A9E9644D /* BolusProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = BolusProvider.swift; sourceTree = "<group>"; };
 		C377490C77661D75E8C50649 /* ManualTempBasalRootView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ManualTempBasalRootView.swift; sourceTree = "<group>"; };
 		C8D1A7CA8C10C4403D4BBFA7 /* BolusDataFlow.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = BolusDataFlow.swift; sourceTree = "<group>"; };
-		CC41E2992B1E1F460070974F /* HistoryLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryLayout.swift; sourceTree = "<group>"; };
 		CC6C406D2ACDD69E009B8058 /* RawFetchedProfile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RawFetchedProfile.swift; sourceTree = "<group>"; };
 		CC76E9502BD4812E008BEB61 /* Forecast+helper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Forecast+helper.swift"; sourceTree = "<group>"; };
 		CE1856F42ADC4858007E39C7 /* AddCarbPresetIntent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddCarbPresetIntent.swift; sourceTree = "<group>"; };
@@ -1014,6 +1013,7 @@
 		DD57C4B02C4C7103001A5B28 /* StatsData+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "StatsData+CoreDataClass.swift"; sourceTree = SOURCE_ROOT; };
 		DD57C4B12C4C7103001A5B28 /* StatsData+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "StatsData+CoreDataProperties.swift"; sourceTree = SOURCE_ROOT; };
 		DD68889C2C386E17006E3C44 /* NightscoutExercise.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NightscoutExercise.swift; sourceTree = "<group>"; };
+		DD88C8E12C50420800F2D558 /* DefinitionRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefinitionRow.swift; sourceTree = "<group>"; };
 		DDD163112C4C689900CD525A /* OverrideStateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OverrideStateModel.swift; sourceTree = "<group>"; };
 		DDD163132C4C68D300CD525A /* OverrideProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OverrideProvider.swift; sourceTree = "<group>"; };
 		DDD163152C4C690300CD525A /* OverrideDataFlow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OverrideDataFlow.swift; sourceTree = "<group>"; };
@@ -1657,6 +1657,7 @@
 				389ECDFD2601061500D86C4F /* View+Snapshot.swift */,
 				38EA05FF262091870064E39B /* BolusProgressViewStyle.swift */,
 				38DF1785276A73D400B3528F /* TagCloudView.swift */,
+				DD88C8E12C50420800F2D558 /* DefinitionRow.swift */,
 			);
 			path = Views;
 			sourceTree = "<group>";
@@ -1753,7 +1754,6 @@
 				19A910352A24D6D700C8951B /* DateFilter.swift */,
 				193F6CDC2A512C8F001240FD /* Loops.swift */,
 				CC6C406D2ACDD69E009B8058 /* RawFetchedProfile.swift */,
-				CC41E2992B1E1F460070974F /* HistoryLayout.swift */,
 				BDF530D72B40F8AC002CAF43 /* LockScreenView.swift */,
 				583684072BD195A700070A60 /* Determination.swift */,
 				BDC2EA462C3045AD00E5BBD0 /* Override.swift */,
@@ -3001,7 +3001,6 @@
 				38E98A2925F52C9300C0CED0 /* Error+Extensions.swift in Sources */,
 				38EA05DA261F6E7C0064E39B /* SimpleLogReporter.swift in Sources */,
 				3811DE6125C9D4D500A708ED /* ViewModifiers.swift in Sources */,
-				CC41E29A2B1E1F460070974F /* HistoryLayout.swift in Sources */,
 				3811DEAC25C9D88300A708ED /* NightscoutManager.swift in Sources */,
 				19A910302A24BF6300C8951B /* StatsView.swift in Sources */,
 				BD7DA9A92AE06E9200601B20 /* BolusCalculatorStateModel.swift in Sources */,
@@ -3203,6 +3202,7 @@
 				BD7DA9A52AE06DFC00601B20 /* BolusCalculatorConfigDataFlow.swift in Sources */,
 				6EADD581738D64431902AC0A /* (null) in Sources */,
 				CE94598729E9E4110047C9C6 /* WatchConfigRootView.swift in Sources */,
+				DD88C8E22C50420800F2D558 /* DefinitionRow.swift in Sources */,
 				B7C465E9472624D8A2BE2A6A /* (null) in Sources */,
 				320D030F724170A637F06D50 /* (null) in Sources */,
 				CE94598729E9E4110047C9C6 /* WatchConfigRootView.swift in Sources */,

+ 0 - 1
FreeAPS/Resources/json/defaults/freeaps/freeaps_settings.json

@@ -53,6 +53,5 @@
   "fattyMealFactor": 0.7,
   "sweetMeals": false,
   "sweetMealFactor": 2
-  "historyLayout": "twoTabs",
   "lockScreenView": "simple"
 }

+ 0 - 5
FreeAPS/Sources/Models/FreeAPSSettings.swift

@@ -57,7 +57,6 @@ struct FreeAPSSettings: JSON, Equatable {
     var sweetMealFactor: Decimal = 2
     var displayPresets: Bool = true
     var useLiveActivity: Bool = false
-    var historyLayout: HistoryLayout = .twoTabs
     var lockScreenView: LockScreenView = .simple
 }
 
@@ -296,10 +295,6 @@ extension FreeAPSSettings: Decodable {
             settings.useLiveActivity = useLiveActivity
         }
 
-        if let historyLayout = try? container.decode(HistoryLayout.self, forKey: .historyLayout) {
-            settings.historyLayout = historyLayout
-        }
-
         if let lockScreenView = try? container.decode(LockScreenView.self, forKey: .lockScreenView) {
             settings.lockScreenView = lockScreenView
         }

+ 0 - 16
FreeAPS/Sources/Models/HistoryLayout.swift

@@ -1,16 +0,0 @@
-import Foundation
-
-enum HistoryLayout: String, JSON, CaseIterable, Identifiable, Codable {
-    var id: String { rawValue }
-    case twoTabs
-    case threeTabs
-
-    var displayName: String {
-        switch self {
-        case .twoTabs:
-            return NSLocalizedString("2 Tabs", comment: "")
-        case .threeTabs:
-            return NSLocalizedString("3 Tabs", comment: "")
-        }
-    }
-}

+ 1 - 1
FreeAPS/Sources/Models/Preferences.swift

@@ -43,7 +43,7 @@ struct Preferences: JSON {
     var timestamp: Date?
     var maxDeltaBGthreshold: Decimal = 0.2
     var adjustmentFactor: Decimal = 0.8
-    var adjustmentFactorSigmoid: Decimal = 0.5
+    var adjustmentFactorSigmoid: Decimal = 0.8
     var sigmoid: Bool = false
     var enableDynamicCR: Bool = false
     var useNewFormula: Bool = false

+ 5 - 1
FreeAPS/Sources/Modules/Dynamic/DynamicStateModel.swift

@@ -8,7 +8,8 @@ extension Dynamic {
         @Published var useNewFormula: Bool = false
         @Published var enableDynamicCR: Bool = false
         @Published var sigmoid: Bool = false
-        @Published var adjustmentFactor: Decimal = 0.5
+        @Published var adjustmentFactor: Decimal = 0.8
+        @Published var adjustmentFactorSigmoid: Decimal = 0.5
         @Published var weightPercentage: Decimal = 0.65
         @Published var tddAdjBasal: Bool = false
         @Published var threshold_setting: Decimal = 65
@@ -24,6 +25,7 @@ extension Dynamic {
             enableDynamicCR = settings.preferences.enableDynamicCR
             sigmoid = settings.preferences.sigmoid
             adjustmentFactor = settings.preferences.adjustmentFactor
+            adjustmentFactorSigmoid = settings.preferences.adjustmentFactorSigmoid
             weightPercentage = settings.preferences.weightPercentage
             tddAdjBasal = settings.preferences.tddAdjBasal
 
@@ -38,6 +40,7 @@ extension Dynamic {
             preferences.enableDynamicCR == enableDynamicCR &&
                 preferences.adjustmentFactor == adjustmentFactor &&
                 preferences.sigmoid == sigmoid &&
+                preferences.adjustmentFactorSigmoid == adjustmentFactorSigmoid &&
                 preferences.tddAdjBasal == tddAdjBasal &&
                 preferences.threshold_setting == convertBack(threshold_setting) &&
                 preferences.useNewFormula == useNewFormula &&
@@ -57,6 +60,7 @@ extension Dynamic {
                 newSettings.enableDynamicCR = enableDynamicCR
                 newSettings.adjustmentFactor = adjustmentFactor
                 newSettings.sigmoid = sigmoid
+                newSettings.adjustmentFactorSigmoid = adjustmentFactorSigmoid
                 newSettings.tddAdjBasal = tddAdjBasal
                 newSettings.threshold_setting = convertBack(threshold_setting)
                 newSettings.useNewFormula = useNewFormula

File diff suppressed because it is too large
+ 108 - 9
FreeAPS/Sources/Modules/Dynamic/View/DynamicRootView.swift


+ 161 - 43
FreeAPS/Sources/Modules/Settings/View/SettingsRootView.swift

@@ -11,7 +11,10 @@ extension Settings {
         @State private var showShareSheet = false
         @StateObject private var viewModel = SettingsRootViewModel()
 
+        @State private var searchText: String = ""
+
         @Environment(\.colorScheme) var colorScheme
+        @EnvironmentObject var appIcons: Icons
 
         private var color: LinearGradient {
             colorScheme == .dark ? LinearGradient(
@@ -32,50 +35,158 @@ extension Settings {
 
         var body: some View {
             Form {
+//                Section {
+//                    Toggle("Closed loop", isOn: $state.closedLoop)
+//                }
+//                header: {
+//                    Text(viewModel.headerText).textCase(nil)
+//                }.listRowBackground(Color.chart)
+
                 Section {
-                    Toggle("Closed loop", isOn: $state.closedLoop)
-                }
-                header: {
-                    Text(viewModel.headerText).textCase(nil)
+                    let buildDetails = BuildDetails.default
+                    let versionNumber = Bundle.main.releaseVersionNumber ?? "Unknown"
+                    let buildNumber = Bundle.main.buildVersionNumber ?? "Unknown"
+                    let branch = buildDetails.branchAndSha
+
+                    Group {
+                        HStack {
+                            Image(uiImage: UIImage(named: appIcons.appIcon.rawValue) ?? UIImage())
+                                .resizable()
+                                .aspectRatio(contentMode: .fit)
+                                .frame(width: 50, height: 50)
+                                .padding(.trailing, 10)
+                            VStack(alignment: .leading) {
+                                Text("Trio v\(versionNumber) (\(buildNumber))")
+                                    .font(.headline)
+                                Text("Branch: \(branch)")
+                                    .font(.footnote)
+                                    .foregroundColor(.secondary)
+                                if let expirationDate = buildDetails.calculateExpirationDate() {
+                                    let formattedDate = DateFormatter.localizedString(
+                                        from: expirationDate,
+                                        dateStyle: .medium,
+                                        timeStyle: .none
+                                    )
+                                    Text("\(buildDetails.expirationHeaderString): \(formattedDate)")
+                                        .font(.footnote)
+                                        .foregroundColor(.secondary)
+                                }
+                            }
+                        }
+
+                        Text("Statistics").navigationLink(to: .statistics, from: self)
+                    }
                 }.listRowBackground(Color.chart)
 
                 Section {
-                    SettingsRowView(imageName: "chart.xyaxis.line", title: "Statistics", tint: Color.green, spacing: 10)
-                        .navigationLink(to: .statistics, from: self)
-                } header: { Text("Statistics") }.listRowBackground(Color.chart)
+                    VStack {
+                        Toggle("Closed Loop", isOn: $state.closedLoop)
+
+                        Spacer()
+
+                        (
+                            Text("Running Trio in")
+                                +
+                                Text(" closed loop mode ").bold()
+                                +
+                                Text("requires an active CGM session sensor session and a connected pump.")
+                                +
+                                Text("This enables automated insulin delivery.").bold()
+                        )
+                        .foregroundColor(.secondary)
+                        .font(.footnote)
+
+                    }.padding(.vertical)
+                }.listRowBackground(Color.chart)
 
                 Section {
                     Text("Pump").navigationLink(to: .pumpConfig, from: self)
                     Text("CGM").navigationLink(to: .cgm, from: self)
                     Text("Watch").navigationLink(to: .watch, from: self)
+                    // TODO: combine pump + pump settings?!
+                    Text("Pump Settings").navigationLink(to: .pumpSettingsEditor, from: self)
                 } header: { Text("Devices") }.listRowBackground(Color.chart)
 
                 Section {
+                    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)
+                    Text("Autotune").navigationLink(to: .autotuneConfig, from: self)
+                } header: { Text("Profiles") }.listRowBackground(Color.chart)
+
+                Section {
+                    Text("Preferences").navigationLink(to: .preferencesEditor, from: self)
+                    Text("Dynamic Settings").navigationLink(to: .dynamicISF, from: self)
+                } header: { Text("Algorithm") }.listRowBackground(Color.chart)
+
+                Section {
+                    Text("UI/UX").navigationLink(to: .statisticsConfig, from: self)
+                    Text("Meal Settings").navigationLink(to: .fpuConfig, from: self)
+                    Text("Bolus Calculator").navigationLink(to: .bolusCalculatorConfig, from: self)
+                    Text("App Icons").navigationLink(to: .iconConfig, from: self)
+                } header: { Text("App Configuration") }.listRowBackground(Color.chart)
+
+                Section {
+                    Text("App Notifications").navigationLink(to: .notificationsConfig, from: self)
+                    Text("Live Activity")
+                } header: { Text("Notifications") }.listRowBackground(Color.chart)
+
+                Section {
                     Text("Nightscout").navigationLink(to: .nighscoutConfig, from: self)
 
                     NavigationLink(destination: TidepoolStartView(state: state)) {
                         Text("Tidepool")
                     }
+
                     if HKHealthStore.isHealthDataAvailable() {
                         Text("Apple Health").navigationLink(to: .healthkit, from: self)
                     }
-                    Text("Notifications").navigationLink(to: .notificationsConfig, from: self)
-                    Text("Bolus Calculator").navigationLink(to: .bolusCalculatorConfig, from: self)
-                    Text("App Icons").navigationLink(to: .iconConfig, from: self)
-                    Text("Statistics and Home View").navigationLink(to: .statisticsConfig, from: self)
                 } header: { Text("Services") }.listRowBackground(Color.chart)
 
                 Section {
-                    Text("Preferences").navigationLink(to: .preferencesEditor, from: self)
-                    Text("Dynamic ISF").navigationLink(to: .dynamicISF, from: self)
-                    Text("Pump Settings").navigationLink(to: .pumpSettingsEditor, from: self)
-                    Text("Meal Settings").navigationLink(to: .fpuConfig, 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)
-                    Text("Autotune").navigationLink(to: .autotuneConfig, from: self)
-                } header: { Text("Configuration") }.listRowBackground(Color.chart)
+                    HStack {
+                        Text("Share Logs")
+                            .onTapGesture {
+                                showShareSheet.toggle()
+                            }
+                        Spacer()
+                        Image(systemName: "chevron.right").foregroundColor(.secondary)
+                    }
+
+                    HStack {
+                        Text("Submit Ticket on GitHub")
+                            .onTapGesture {
+                                if let url = URL(string: "https://github.com/nightscout/Trio/issues/new/choose") {
+                                    UIApplication.shared.open(url)
+                                }
+                            }
+                        Spacer()
+                        Image(systemName: "chevron.right").foregroundColor(.secondary)
+                    }
+
+                    HStack {
+                        Text("Trio Discord")
+                            .onTapGesture {
+                                if let url = URL(string: "https://discord.gg/FnwFEFUwXE") {
+                                    UIApplication.shared.open(url)
+                                }
+                            }
+                        Spacer()
+                        Image(systemName: "chevron.right").foregroundColor(.secondary)
+                    }
+
+                    HStack {
+                        Text("Trio Facebook")
+                            .onTapGesture {
+                                if let url = URL(string: "https://m.facebook.com/groups/1351938092206709/") {
+                                    UIApplication.shared.open(url)
+                                }
+                            }
+                        Spacer()
+                        Image(systemName: "chevron.right").foregroundColor(.secondary)
+                    }
+                } header: { Text("Support") }.listRowBackground(Color.chart)
 
                 Section {
                     Toggle("Debug options", isOn: $state.debugOptions)
@@ -105,8 +216,8 @@ extension Settings {
                                 .navigationLink(to: .configEditor(file: OpenAPS.Settings.settings), from: self)
                             Text("Autosense")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Settings.autosense), from: self)
-                            Text("Pump History")
-                                .navigationLink(to: .configEditor(file: OpenAPS.Monitor.pumpHistory), from: self)
+//                            Text("Pump History")
+//                                .navigationLink(to: .configEditor(file: OpenAPS.Monitor.pumpHistory), from: self)
                             Text("Basal profile")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Settings.basalProfile), from: self)
                             Text("Targets ranges")
@@ -120,12 +231,12 @@ extension Settings {
                                 .navigationLink(to: .configEditor(file: OpenAPS.Settings.pumpProfile), from: self)
                             Text("Profile")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Settings.profile), from: self)
-                            Text("Carbs")
-                                .navigationLink(to: .configEditor(file: OpenAPS.Monitor.carbHistory), from: self)
-                            Text("Announcements")
-                                .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.announcements), from: self)
-                            Text("Enacted announcements")
-                                .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.announcementsEnacted), from: self)
+//                            Text("Carbs")
+//                                .navigationLink(to: .configEditor(file: OpenAPS.Monitor.carbHistory), from: self)
+//                            Text("Announcements")
+//                                .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.announcements), from: self)
+//                            Text("Enacted announcements")
+//                                .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.announcementsEnacted), from: self)
                             Text("Autotune")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Settings.autotune), from: self)
                         }
@@ -137,31 +248,38 @@ extension Settings {
                                 .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.calibrations), from: self)
                             Text("Middleware")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Middleware.determineBasal), from: self)
-                            Text("Statistics")
-                                .navigationLink(to: .configEditor(file: OpenAPS.Monitor.statistics), from: self)
+//                            Text("Statistics")
+//                                .navigationLink(to: .configEditor(file: OpenAPS.Monitor.statistics), from: self)
                             Text("Edit settings json")
                                 .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.settings), from: self)
                         }
                     }
                 } header: { Text("Developer") }.listRowBackground(Color.chart)
-
-                Section {
-                    HStack {
-                        Text("Share logs")
-                            .onTapGesture {
-                                showShareSheet.toggle()
-                            }
-                        Spacer()
-                        Image(systemName: "square.and.arrow.up")
-                    }
-                }.listRowBackground(Color.chart)
             }.scrollContentBackground(.hidden).background(color)
                 .sheet(isPresented: $showShareSheet) {
                     ShareSheet(activityItems: state.logItems())
                 }
                 .onAppear(perform: configureView)
                 .navigationTitle("Settings")
-                .navigationBarTitleDisplayMode(.large)
+                .navigationBarTitleDisplayMode(.automatic)
+                .toolbar {
+                    ToolbarItem(placement: .topBarTrailing) {
+                        Button(
+                            action: {
+                                if let url = URL(string: "https://triodocs.org/") {
+                                    UIApplication.shared.open(url)
+                                }
+                            },
+                            label: {
+                                HStack {
+                                    Text("Trio Docs")
+                                    Image(systemName: "questionmark.circle")
+                                }
+                            }
+                        )
+                    }
+                }
+//                .searchable(text: $searchText, placement: .navigationBarDrawer(displayMode: .always))
                 .onDisappear(perform: { state.uploadProfileAndSettings(false) })
                 .screenNavigation(self)
         }

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

@@ -7,7 +7,6 @@ extension StatConfig {
         @Published var skipBolusScreenAfterCarbs: Bool = false
         @Published var useFPUconversion: Bool = true
         @Published var tins: Bool = false
-        @Published var historyLayout: HistoryLayout = .twoTabs
         @Published var lockScreenView: LockScreenView = .simple
         @Published var low: Decimal = 70
         @Published var high: Decimal = 180
@@ -31,7 +30,6 @@ extension StatConfig {
             subscribeSetting(\.tins, on: $tins) { tins = $0 }
             subscribeSetting(\.skipBolusScreenAfterCarbs, on: $skipBolusScreenAfterCarbs) { skipBolusScreenAfterCarbs = $0 }
             subscribeSetting(\.oneDimensionalGraph, on: $oneDimensionalGraph) { oneDimensionalGraph = $0 }
-            subscribeSetting(\.historyLayout, on: $historyLayout) { historyLayout = $0 }
             subscribeSetting(\.lockScreenView, on: $lockScreenView) { lockScreenView = $0 }
 
             subscribeSetting(\.low, on: $low, initial: {

+ 0 - 11
FreeAPS/Sources/Modules/StatConfig/View/StatConfigRootView.swift

@@ -82,17 +82,6 @@ extension StatConfig {
 
                 Section {
                     Picker(
-                        selection: $state.historyLayout,
-                        label: Text("History Layout")
-                    ) {
-                        ForEach(HistoryLayout.allCases) { selection in
-                            Text(selection.displayName).tag(selection)
-                        }
-                    }
-                } header: { Text("History Settings") }
-
-                Section {
-                    Picker(
                         selection: $state.lockScreenView,
                         label: Text("Lock screen widget")
                     ) {

+ 22 - 7
FreeAPS/Sources/Views/DefinitionRow.swift

@@ -1,8 +1,23 @@
-//
-//  DefinitionRow.swift
-//  FreeAPS
-//
-//  Created by Cengiz Deniz on 23.07.24.
-//
-
 import Foundation
+import SwiftUI
+
+struct DefinitionRow: View {
+    var term: String
+    var definition: String
+    var color: Color?
+
+    var body: some View {
+        VStack(alignment: .leading) {
+            HStack {
+                if let color = color {
+                    Image(systemName: "circle.fill").foregroundStyle(color)
+                }
+                Text(term).font(.subheadline).fontWeight(.semibold)
+            }
+            Text(definition)
+                .font(.subheadline)
+                .foregroundColor(.secondary)
+        }
+        .padding(.vertical, 5)
+    }
+}