Преглед изворни кода

Remove old preferences view

Deniz Cengiz пре 1 година
родитељ
комит
6cb1db8cb8

+ 0 - 32
FreeAPS.xcodeproj/project.pbxproj

@@ -235,7 +235,6 @@
 		38FEF3FC2737E53800574A46 /* MainStateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38FEF3FB2737E53800574A46 /* MainStateModel.swift */; };
 		38FEF3FE2738083E00574A46 /* CGMProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38FEF3FD2738083E00574A46 /* CGMProvider.swift */; };
 		38FEF413273B317A00574A46 /* HKUnit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38FEF412273B317A00574A46 /* HKUnit.swift */; };
-		44190F0BBA464D74B857D1FB /* PreferencesEditorRootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A965332F237348B119FB858 /* PreferencesEditorRootView.swift */; };
 		448B6FCB252BD4796E2960C0 /* PumpSettingsEditorDataFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0274EE6439B1C3ED70730D41 /* PumpSettingsEditorDataFlow.swift */; };
 		45252C95D220E796FDB3B022 /* ConfigEditorDataFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F8A87AA037BD079BA3528BA /* ConfigEditorDataFlow.swift */; };
 		45717281F743594AA9D87191 /* ConfigEditorRootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 920DDB21E5D0EB813197500D /* ConfigEditorRootView.swift */; };
@@ -290,7 +289,6 @@
 		98641AF4F92123DA668AB931 /* CarbRatioEditorRootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BDC6993C1087310EDFC428 /* CarbRatioEditorRootView.swift */; };
 		A05235B9112E677ED03B6E8E /* AutotuneConfigRootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CF5ACEE1F0859670E71B2C0 /* AutotuneConfigRootView.swift */; };
 		A0B8EC8CC5CD1DD237D1BCD2 /* PumpSettingsEditorRootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8C7F882606FF83A21BE00D8 /* PumpSettingsEditorRootView.swift */; };
-		A228DF96647338139F152B15 /* PreferencesEditorDataFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12204445D7632AF09264A979 /* PreferencesEditorDataFlow.swift */; };
 		A33352ED40476125EBAC6EE0 /* CarbRatioEditorDataFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E22146D3DF4853786C78132 /* CarbRatioEditorDataFlow.swift */; };
 		AD3D2CD42CD01B9EB8F26522 /* PumpConfigDataFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF65DA88F972B56090AD6AC3 /* PumpConfigDataFlow.swift */; };
 		B7C465E9472624D8A2BE2A6A /* (null) in Sources */ = {isa = PBXBuildFile; };
@@ -421,7 +419,6 @@
 		DD1DB7CC2BECCA1F0048B367 /* BuildDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD1DB7CB2BECCA1F0048B367 /* BuildDetails.swift */; };
 		DD21FCB52C6952AD00AF2C25 /* DecimalPickerSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD21FCB42C6952AD00AF2C25 /* DecimalPickerSettings.swift */; };
 		DD21FCB72C6AA2F000AF2C25 /* Rounding.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD21FCB62C6AA2F000AF2C25 /* Rounding.swift */; };
-		DD399FB31EACB9343C944C4C /* PreferencesEditorStateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CA3E609094E064C99A4752C /* PreferencesEditorStateModel.swift */; };
 		DD57C4B22C4C7103001A5B28 /* LoopStatRecord+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD57C4902C4C7103001A5B28 /* LoopStatRecord+CoreDataClass.swift */; };
 		DD57C4B32C4C7103001A5B28 /* LoopStatRecord+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD57C4912C4C7103001A5B28 /* LoopStatRecord+CoreDataProperties.swift */; };
 		DD57C4B42C4C7103001A5B28 /* MealPresetStored+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD57C4922C4C7103001A5B28 /* MealPresetStored+CoreDataClass.swift */; };
@@ -484,7 +481,6 @@
 		E13B7DAB2A435F57066AF02E /* TargetsEditorStateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36F58DDD71F0E795464FA3F0 /* TargetsEditorStateModel.swift */; };
 		E39E418C56A5A46B61D960EE /* ConfigEditorStateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D5B4F8B4194BB7E260EF251 /* ConfigEditorStateModel.swift */; };
 		E3A08AAE59538BC8A8ABE477 /* GlucoseNotificationSettingsDataFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3260468377DA9DB4DEE9AF6D /* GlucoseNotificationSettingsDataFlow.swift */; };
-		E4984C5262A90469788754BB /* PreferencesEditorProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F8BA8533F56BC55748CA877 /* PreferencesEditorProvider.swift */; };
 		E974172296125A5AE99E634C /* PumpConfigRootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AD22C985B79A2F0D2EA3D9D /* PumpConfigRootView.swift */; };
 		F5CA3DB1F9DC8B05792BBFAA /* CGMDataFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9B5C0607505A38F256BF99A /* CGMDataFlow.swift */; };
 		F5F7E6C1B7F098F59EB67EC5 /* TargetsEditorDataFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA49538D56989D8DA6FCF538 /* TargetsEditorDataFlow.swift */; };
@@ -588,14 +584,12 @@
 
 /* Begin PBXFileReference section */
 		0274EE6439B1C3ED70730D41 /* PumpSettingsEditorDataFlow.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = PumpSettingsEditorDataFlow.swift; sourceTree = "<group>"; };
-		0CA3E609094E064C99A4752C /* PreferencesEditorStateModel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = PreferencesEditorStateModel.swift; sourceTree = "<group>"; };
 		110AEDE02C5193D100615CC9 /* BolusIntent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BolusIntent.swift; sourceTree = "<group>"; };
 		110AEDE12C5193D100615CC9 /* BolusIntentRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BolusIntentRequest.swift; sourceTree = "<group>"; };
 		110AEDE52C51A0AE00615CC9 /* ShortcutsConfigView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShortcutsConfigView.swift; sourceTree = "<group>"; };
 		110AEDE72C51A0AE00615CC9 /* ShortcutsConfigDataFlow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShortcutsConfigDataFlow.swift; sourceTree = "<group>"; };
 		110AEDE82C51A0AE00615CC9 /* ShortcutsConfigProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShortcutsConfigProvider.swift; sourceTree = "<group>"; };
 		110AEDE92C51A0AE00615CC9 /* ShortcutsConfigStateModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShortcutsConfigStateModel.swift; sourceTree = "<group>"; };
-		12204445D7632AF09264A979 /* PreferencesEditorDataFlow.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = PreferencesEditorDataFlow.swift; sourceTree = "<group>"; };
 		19012CDB291D2CB900FB8210 /* LoopStats.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoopStats.swift; sourceTree = "<group>"; };
 		190EBCC329FF136900BA767D /* UserInterfaceSettingsDataFlow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserInterfaceSettingsDataFlow.swift; sourceTree = "<group>"; };
 		190EBCC529FF138000BA767D /* UserInterfaceSettingsProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserInterfaceSettingsProvider.swift; sourceTree = "<group>"; };
@@ -912,13 +906,11 @@
 		6B1A8D252B14D91700E76752 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
 		6B1A8D2D2B156EEF00E76752 /* LiveActivityBridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiveActivityBridge.swift; sourceTree = "<group>"; };
 		6BCF84DC2B16843A003AD46E /* LiveActitiyAttributes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiveActitiyAttributes.swift; sourceTree = "<group>"; };
-		6F8BA8533F56BC55748CA877 /* PreferencesEditorProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = PreferencesEditorProvider.swift; sourceTree = "<group>"; };
 		72778B68C3004F71F6E79BDC /* PumpSettingsEditorStateModel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = PumpSettingsEditorStateModel.swift; sourceTree = "<group>"; };
 		79BDA519C9B890FD9A5DFCF3 /* ISFEditorDataFlow.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ISFEditorDataFlow.swift; sourceTree = "<group>"; };
 		7E22146D3DF4853786C78132 /* CarbRatioEditorDataFlow.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = CarbRatioEditorDataFlow.swift; sourceTree = "<group>"; };
 		8782B44544F38F2B2D82C38E /* NightscoutConfigRootView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = NightscoutConfigRootView.swift; sourceTree = "<group>"; };
 		881E04BA5E0A003DE8E0A9C6 /* DataTableRootView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = DataTableRootView.swift; sourceTree = "<group>"; };
-		8A965332F237348B119FB858 /* PreferencesEditorRootView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = PreferencesEditorRootView.swift; sourceTree = "<group>"; };
 		8CF5ACEE1F0859670E71B2C0 /* AutotuneConfigRootView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = AutotuneConfigRootView.swift; sourceTree = "<group>"; };
 		8DCCCCE633F5E98E41B0CD3C /* AutotuneConfigDataFlow.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = AutotuneConfigDataFlow.swift; sourceTree = "<group>"; };
 		920DDB21E5D0EB813197500D /* ConfigEditorRootView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ConfigEditorRootView.swift; sourceTree = "<group>"; };
@@ -1435,7 +1427,6 @@
 				19D466A129AA2B0A004D5F33 /* MealSettings */,
 				D533BF261CDC1C3F871E7BFD /* NightscoutConfig */,
 				DDD163032C4C67B400CD525A /* OverrideConfig */,
-				3E1C41D9301B7058AA7BF5EA /* PreferencesEditor */,
 				99C01B871ACAB3F32CE755C7 /* PumpConfig */,
 				E493126EA71765130F64CCE5 /* PumpSettingsEditor */,
 				3811DE3825C9D4A100A708ED /* Settings */,
@@ -2119,17 +2110,6 @@
 			path = FreeAPSTests;
 			sourceTree = "<group>";
 		};
-		3E1C41D9301B7058AA7BF5EA /* PreferencesEditor */ = {
-			isa = PBXGroup;
-			children = (
-				12204445D7632AF09264A979 /* PreferencesEditorDataFlow.swift */,
-				6F8BA8533F56BC55748CA877 /* PreferencesEditorProvider.swift */,
-				0CA3E609094E064C99A4752C /* PreferencesEditorStateModel.swift */,
-				833DA2F9E47E64E305F92F9D /* View */,
-			);
-			path = PreferencesEditor;
-			sourceTree = "<group>";
-		};
 		4E8C7B59F8065047ECE20965 /* View */ = {
 			isa = PBXGroup;
 			children = (
@@ -2269,14 +2249,6 @@
 			path = LiveActivity;
 			sourceTree = "<group>";
 		};
-		833DA2F9E47E64E305F92F9D /* View */ = {
-			isa = PBXGroup;
-			children = (
-				8A965332F237348B119FB858 /* PreferencesEditorRootView.swift */,
-			);
-			path = View;
-			sourceTree = "<group>";
-		};
 		84BDC840A57C65A1E6F9F780 /* View */ = {
 			isa = PBXGroup;
 			children = (
@@ -3458,16 +3430,12 @@
 				9702FF92A09C53942F20D7EA /* TargetsEditorRootView.swift in Sources */,
 				1967DFBE29D052C200759F30 /* Icons.swift in Sources */,
 				38E8754F275556FA00975559 /* WatchManager.swift in Sources */,
-				A228DF96647338139F152B15 /* PreferencesEditorDataFlow.swift in Sources */,
 				DDD163182C4C694000CD525A /* OverrideRootView.swift in Sources */,
 				389ECE052601144100D86C4F /* ConcurrentMap.swift in Sources */,
 				110AEDEC2C51A0AE00615CC9 /* ShortcutsConfigDataFlow.swift in Sources */,
 				CE7CA3562A064973004BE681 /* StateIntentRequest.swift in Sources */,
-				E4984C5262A90469788754BB /* PreferencesEditorProvider.swift in Sources */,
-				DD399FB31EACB9343C944C4C /* PreferencesEditorStateModel.swift in Sources */,
 				19E1F7EA29D082ED005C8D20 /* IconConfigProvider.swift in Sources */,
 				DD09D4822C5986F6003FEA5D /* CalendarEventSettingsRootView.swift in Sources */,
-				44190F0BBA464D74B857D1FB /* PreferencesEditorRootView.swift in Sources */,
 				CE48C86428CA69D5007C0598 /* OmniBLEPumpManagerExtensions.swift in Sources */,
 				38E8755427561E9800975559 /* DataFlow.swift in Sources */,
 				38E44522274E3DDC00EC9A94 /* NetworkReachabilityManager.swift in Sources */,

+ 0 - 117
FreeAPS/Sources/Modules/PreferencesEditor/PreferencesEditorDataFlow.swift

@@ -1,117 +0,0 @@
-import Foundation
-import LoopKit
-
-protocol SettableValue {}
-extension Bool: SettableValue {}
-extension Decimal: SettableValue {}
-extension InsulinCurve: SettableValue {}
-
-enum PreferencesEditor {
-    enum Config {}
-
-    enum FieldType {
-        case boolean(keypath: WritableKeyPath<Preferences, Bool>)
-        case decimal(
-            keypath: WritableKeyPath<Preferences, Decimal>,
-            minVal: WritableKeyPath<Preferences, Decimal>? = nil,
-            maxVal: WritableKeyPath<Preferences, Decimal>? = nil
-        )
-        case insulinCurve(keypath: WritableKeyPath<Preferences, InsulinCurve>)
-    }
-
-    class Field: Identifiable {
-        var displayName: String
-        var type: FieldType
-        var infoText: String
-
-        var boolValue: Bool {
-            get {
-                switch type {
-                case let .boolean(keypath):
-                    return settable?.get(keypath) ?? false
-                default: return false
-                }
-            }
-            set { set(value: newValue) }
-        }
-
-        var decimalValue: Decimal {
-            get {
-                switch type {
-                case let .decimal(keypath, _, _):
-                    return settable?.get(keypath) ?? 0
-                default: return 0
-                }
-            }
-            set { set(value: newValue) }
-        }
-
-        var insulinCurveValue: InsulinCurve {
-            get {
-                switch type {
-                case let .insulinCurve(keypath):
-                    return settable?.get(keypath) ?? .rapidActing
-                default: return .rapidActing
-                }
-            }
-            set { set(value: newValue) }
-        }
-
-        private func set<T: SettableValue>(value: T) {
-            switch (type, value) {
-            case let (.boolean(keypath), value as Bool):
-                settable?.set(keypath, value: value)
-            case let (.decimal(keypath, minVal, maxVal), value as Decimal):
-                let constrainedValue: Decimal
-                if let minValue = minVal, let minValueDecimal: Decimal = settable?.get(minValue), let maxValue = maxVal,
-                   let maxValueDecimal: Decimal = settable?.get(maxValue)
-                {
-                    constrainedValue = min(max(value, minValueDecimal), maxValueDecimal)
-                } else if let minValue = minVal, let minValueDecimal: Decimal = settable?.get(minValue) {
-                    constrainedValue = max(value, minValueDecimal)
-                } else if let maxValue = maxVal, let maxValueDecimal: Decimal = settable?.get(maxValue) {
-                    constrainedValue = min(value, maxValueDecimal)
-                } else {
-                    constrainedValue = value
-                }
-                settable?.set(keypath, value: constrainedValue)
-            case let (.insulinCurve(keypath), value as InsulinCurve):
-                settable?.set(keypath, value: value)
-            default: break
-            }
-        }
-
-        weak var settable: PreferencesSettable?
-
-        init(
-            displayName: String,
-            type: FieldType,
-            infoText: String,
-            settable: PreferencesSettable? = nil
-        ) {
-            self.displayName = displayName
-            self.type = type
-            self.infoText = infoText
-            self.settable = settable
-        }
-
-        let id = UUID()
-    }
-
-    struct FieldSection: Identifiable {
-        let displayName: String
-        var fields: [Field]
-        let id = UUID()
-    }
-}
-
-protocol PreferencesEditorProvider: Provider {
-    var preferences: Preferences { get }
-    func savePreferences(_ preferences: Preferences)
-    func migrateUnits()
-}
-
-protocol PreferencesSettable: AnyObject {
-    func set<T>(_ keypath: WritableKeyPath<Preferences, T>, value: T)
-    func get<T>(_ keypath: WritableKeyPath<Preferences, T>) -> T
-}

+ 0 - 88
FreeAPS/Sources/Modules/PreferencesEditor/PreferencesEditorProvider.swift

@@ -1,88 +0,0 @@
-import Foundation
-
-extension PreferencesEditor {
-    final class Provider: BaseProvider, PreferencesEditorProvider {
-        @Injected() private var settingsManager: SettingsManager!
-        private let processQueue = DispatchQueue(label: "PreferencesEditorProvider.processQueue")
-
-        var preferences: Preferences {
-            settingsManager.preferences
-        }
-
-        func savePreferences(_ preferences: Preferences) {
-            processQueue.async {
-                var prefs = preferences
-                prefs.timestamp = Date()
-                self.storage.save(prefs, as: OpenAPS.Settings.preferences)
-            }
-        }
-
-        func migrateUnits() {
-            migrateTargets()
-            migrateISF()
-        }
-
-        private func migrateTargets() {
-            let profile = storage.retrieve(OpenAPS.Settings.bgTargets, as: BGTargets.self)
-                ?? BGTargets(from: OpenAPS.defaults(for: OpenAPS.Settings.bgTargets))
-                ?? BGTargets(units: .mmolL, userPrefferedUnits: .mmolL, targets: [])
-
-            let units = settingsManager.settings.units
-            guard units != profile.units else { return }
-
-            let targets = profile.targets.map { target -> BGTargetEntry in
-                if units == .mmolL {
-                    return BGTargetEntry(
-                        low: Decimal(round(Double(target.low.asMmolL) * 10) / 10),
-                        high: Decimal(round(Double(target.high.asMmolL) * 10) / 10),
-                        start: target.start,
-                        offset: target.offset
-                    )
-                } else {
-                    return BGTargetEntry(
-                        low: Decimal(round(Double(target.low.asMgdL))),
-                        high: Decimal(round(Double(target.high.asMgdL))),
-                        start: target.start,
-                        offset: target.offset
-                    )
-                }
-            }
-
-            let newProfile = BGTargets(units: units, userPrefferedUnits: units, targets: targets)
-            storage.save(newProfile, as: OpenAPS.Settings.bgTargets)
-        }
-
-        private func migrateISF() {
-            let profile = storage.retrieve(OpenAPS.Settings.insulinSensitivities, as: InsulinSensitivities.self)
-                ?? InsulinSensitivities(from: OpenAPS.defaults(for: OpenAPS.Settings.insulinSensitivities))
-                ?? InsulinSensitivities(
-                    units: .mmolL,
-                    userPrefferedUnits: .mmolL,
-                    sensitivities: []
-                )
-            let units = settingsManager.settings.units
-            guard units != profile.units else { return }
-
-            let sensitivities = profile.sensitivities.map { item -> InsulinSensitivityEntry in
-
-                if units == .mmolL {
-                    return InsulinSensitivityEntry(
-                        sensitivity: Decimal(round(Double(item.sensitivity.asMmolL) * 10) / 10),
-                        offset: item.offset,
-                        start: item.start
-                    )
-                } else {
-                    return InsulinSensitivityEntry(
-                        sensitivity: Decimal(round(Double(item.sensitivity.asMgdL))),
-                        offset: item.offset,
-                        start: item.start
-                    )
-                }
-            }
-
-            let newProfile = InsulinSensitivities(units: units, userPrefferedUnits: units, sensitivities: sensitivities)
-
-            storage.save(newProfile, as: OpenAPS.Settings.insulinSensitivities)
-        }
-    }
-}

Разлика између датотеке није приказан због своје велике величине
+ 0 - 408
FreeAPS/Sources/Modules/PreferencesEditor/PreferencesEditorStateModel.swift


+ 0 - 134
FreeAPS/Sources/Modules/PreferencesEditor/View/PreferencesEditorRootView.swift

@@ -1,134 +0,0 @@
-import SwiftUI
-import Swinject
-
-struct InfoText: Identifiable {
-    var id: String { description }
-    let description: String
-    let oref0Variable: String
-}
-
-extension PreferencesEditor {
-    struct RootView: BaseView {
-        let resolver: Resolver
-        @StateObject var state = StateModel()
-
-        @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
-                )
-        }
-
-        private var formatter: NumberFormatter {
-            let formatter = NumberFormatter()
-            formatter.numberStyle = .decimal
-            return formatter
-        }
-
-        @State private var infoButtonPressed: InfoText?
-
-        var body: some View {
-            Form {
-                Section(header: Text("Trio").textCase(nil)) {
-                    Picker("Glucose units", selection: $state.unitsIndex) {
-                        Text("mg/dL").tag(0)
-                        Text("mmol/L").tag(1)
-                    }
-                }
-
-                ForEach(state.sections.indexed(), id: \.1.id) { sectionIndex, section in
-                    Section(header: Text(section.displayName)) {
-                        ForEach(section.fields.indexed(), id: \.1.id) { fieldIndex, field in
-                            HStack {
-                                switch field.type {
-                                case .boolean:
-                                    ZStack {
-                                        Button("", action: {
-                                            infoButtonPressed = InfoText(
-                                                description: field.infoText,
-                                                oref0Variable: field.displayName
-                                            )
-                                        })
-                                        Toggle(isOn: self.$state.sections[sectionIndex].fields[fieldIndex].boolValue) {
-                                            Text(field.displayName)
-                                        }
-                                    }
-                                case .decimal:
-                                    ZStack {
-                                        Button("", action: {
-                                            infoButtonPressed = InfoText(
-                                                description: field.infoText,
-                                                oref0Variable: field.displayName
-                                            )
-                                        })
-                                        Text(field.displayName)
-                                    }
-                                    TextFieldWithToolBar(
-                                        text: self.$state.sections[sectionIndex].fields[fieldIndex].decimalValue,
-                                        placeholder: "0",
-                                        numberFormatter: formatter
-                                    )
-                                case .insulinCurve:
-                                    Picker(
-                                        selection: $state.sections[sectionIndex].fields[fieldIndex].insulinCurveValue,
-                                        label: Text(field.displayName)
-                                    ) {
-                                        ForEach(InsulinCurve.allCases) { v in
-                                            Text(v.rawValue).tag(v)
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-            .scrollContentBackground(.hidden).background(color)
-            .onAppear(perform: configureView)
-            .navigationTitle("Preferences")
-            .navigationBarTitleDisplayMode(.automatic)
-            .navigationBarItems(
-                trailing:
-                Button {
-                    let lang = Locale.current.languageCode ?? "en"
-                    if lang == "en" {
-                        UIApplication.shared.open(
-                            URL(
-                                string: "https://openaps.readthedocs.io/en/latest/docs/While%20You%20Wait%20For%20Gear/preferences-and-safety-settings.html"
-                            )!,
-                            options: [:],
-                            completionHandler: nil
-                        )
-                    } else {
-                        UIApplication.shared.open(
-                            URL(
-                                string: "https://openaps-readthedocs-io.translate.goog/en/latest/docs/While%20You%20Wait%20For%20Gear/preferences-and-safety-settings.html?_x_tr_sl=en&_x_tr_tl=\(lang)&_x_tr_hl=\(lang)"
-                            )!,
-                            options: [:],
-                            completionHandler: nil
-                        )
-                    }
-                }
-                label: { Image(systemName: "questionmark.circle") }
-            )
-            .alert(item: $infoButtonPressed) { infoButton in
-                Alert(
-                    title: Text("\(infoButton.oref0Variable)"),
-                    message: Text("\(infoButton.description)"),
-                    dismissButton: .default(Text("OK"))
-                )
-            }
-        }
-    }
-}

+ 0 - 3
FreeAPS/Sources/Router/Screen.swift

@@ -15,7 +15,6 @@ enum Screen: Identifiable, Hashable {
     case isfEditor
     case crEditor
     case targetsEditor
-    case preferencesEditor
     case bolus
     case manualTempBasal
     case autotuneConfig
@@ -81,8 +80,6 @@ extension Screen {
             CarbRatioEditor.RootView(resolver: resolver)
         case .targetsEditor:
             TargetsEditor.RootView(resolver: resolver)
-        case .preferencesEditor:
-            PreferencesEditor.RootView(resolver: resolver)
         case .bolus:
             Bolus.RootView(resolver: resolver)
         case .manualTempBasal: