Przeglądaj źródła

Debug options under Toggle

Ivan Valkou 4 lat temu
rodzic
commit
792872c04f

+ 5 - 1
FreeAPS/Sources/Modules/CREditor/View/CREditorRootView.swift

@@ -37,7 +37,11 @@ extension CREditor {
                     addButton
                 }
                 Section {
-                    Button { state.save() }
+                    Button {
+                        let impactHeavy = UIImpactFeedbackGenerator(style: .heavy)
+                        impactHeavy.impactOccurred()
+                        state.save()
+                    }
                     label: {
                         Text("Save")
                     }

+ 2 - 0
FreeAPS/Sources/Modules/ConfigEditor/ConfigEditorStateModel.swift

@@ -11,6 +11,8 @@ extension ConfigEditor {
         }
 
         func save() {
+            let impactHeavy = UIImpactFeedbackGenerator(style: .heavy)
+            impactHeavy.impactOccurred()
             provider.save(configText, as: file)
         }
     }

+ 5 - 1
FreeAPS/Sources/Modules/ISFEditor/View/ISFEditorRootView.swift

@@ -57,7 +57,11 @@ extension ISFEditor {
                     addButton
                 }
                 Section {
-                    Button { state.save() }
+                    Button {
+                        let impactHeavy = UIImpactFeedbackGenerator(style: .heavy)
+                        impactHeavy.impactOccurred()
+                        state.save()
+                    }
                     label: {
                         Text("Save")
                     }

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

@@ -84,11 +84,6 @@ extension PreferencesEditor {
                         }
                     }
                 }
-
-                Section {
-                    Text("Edit settings json")
-                        .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.settings), from: self)
-                }
             }
             .onAppear(perform: configureView)
             .navigationTitle("Preferences")

+ 1 - 2
FreeAPS/Sources/Modules/Settings/SettingsStateModel.swift

@@ -11,8 +11,7 @@ extension Settings {
         private(set) var buildNumber = ""
 
         override func subscribe() {
-            debugOptions = settingsManager.settings.debugOptions
-
+            subscribeSetting(\.debugOptions, on: $debugOptions) { debugOptions = $0 }
             subscribeSetting(\.closedLoop, on: $closedLoop) { closedLoop = $0 }
 
             broadcaster.register(SettingsObserver.self, observer: self)

+ 5 - 2
FreeAPS/Sources/Modules/Settings/View/SettingsRootView.swift

@@ -34,8 +34,9 @@ extension Settings {
                     Text("Autotune").navigationLink(to: .autotuneConfig, from: self)
                 }
 
-                if state.debugOptions {
-                    Section(header: Text("Config files")) {
+                Section(header: Text("Developer")) {
+                    Toggle("Debug options", isOn: $state.debugOptions)
+                    if state.debugOptions {
                         Group {
                             Text("Preferences")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Settings.preferences), from: self)
@@ -91,6 +92,8 @@ extension Settings {
                                 .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.calibrations), from: self)
                             Text("Middleware")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Middleware.determineBasal), from: self)
+                            Text("Edit settings json")
+                                .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.settings), from: self)
                         }
                     }
                 }

+ 5 - 1
FreeAPS/Sources/Modules/TargetsEditor/View/TargetsEditorRootView.swift

@@ -27,7 +27,11 @@ extension TargetsEditor {
                     addButton
                 }
                 Section {
-                    Button { state.save() }
+                    Button {
+                        let impactHeavy = UIImpactFeedbackGenerator(style: .heavy)
+                        impactHeavy.impactOccurred()
+                        state.save()
+                    }
                     label: {
                         Text("Save")
                     }