ソースを参照

Fix coloring for NS setting views for sections; settings still WIP

Deniz Cengiz 1 年間 前
コミット
23d901211a

+ 27 - 22
FreeAPS/Sources/Modules/NightscoutConfig/View/NightscoutConfigRootView.swift

@@ -45,9 +45,11 @@ extension NightscoutConfig {
 
         var body: some View {
             Form {
-                NavigationLink("Connect", destination: NightscoutConnectView(state: state))
-                NavigationLink("Upload", destination: NightscoutUploadView(state: state))
-                NavigationLink("Fetch and Remote Control", destination: NightscoutFetchView(state: state))
+                Section {
+                    NavigationLink("Connect", destination: NightscoutConnectView(state: state))
+                    NavigationLink("Upload", destination: NightscoutUploadView(state: state))
+                    NavigationLink("Fetch and Remote Control", destination: NightscoutFetchView(state: state))
+                }.listRowBackground(Color.chart)
 
                 Section(
                     header: Text("Import Settings from Nightscout"),
@@ -83,24 +85,26 @@ extension NightscoutConfig {
                             secondaryButton: .cancel()
                         )
                         isImportAlertPresented.toggle()
-                    }.disabled(state.url.isEmpty || state.connecting)
-                        .alert(isPresented: $importedHasRun) {
-                            Alert(
-                                title: Text((fetchedErrors.first?.error ?? "").count < 4 ? "Settings imported" : "Import Error"),
-                                message: Text(
-                                    (fetchedErrors.first?.error ?? "").count < 4 ?
-                                        NSLocalizedString(
-                                            "\nNow please verify all of your new settings thoroughly: \n\n • DIA (Pump settings)\n • Basal Profile\n • Insulin Sensitivities\n • Carb Ratios\n • Target Glucose\n\n in Trio Settings -> Configuration.\n\nBad or invalid profile settings could have disastrous effects.",
-                                            comment: "Imported Profiles Alert"
-                                        ) :
-                                        NSLocalizedString(fetchedErrors.first?.error ?? "", comment: "Import Error")
-                                ),
-                                primaryButton: .destructive(
-                                    Text("OK")
-                                ),
-                                secondaryButton: .cancel()
-                            )
-                        }
+                    }
+                    .listRowBackground(Color.chart)
+                    .disabled(state.url.isEmpty || state.connecting)
+                    .alert(isPresented: $importedHasRun) {
+                        Alert(
+                            title: Text((fetchedErrors.first?.error ?? "").count < 4 ? "Settings imported" : "Import Error"),
+                            message: Text(
+                                (fetchedErrors.first?.error ?? "").count < 4 ?
+                                    NSLocalizedString(
+                                        "\nNow please verify all of your new settings thoroughly: \n\n • DIA (Pump settings)\n • Basal Profile\n • Insulin Sensitivities\n • Carb Ratios\n • Target Glucose\n\n in Trio Settings -> Configuration.\n\nBad or invalid profile settings could have disastrous effects.",
+                                        comment: "Imported Profiles Alert"
+                                    ) :
+                                    NSLocalizedString(fetchedErrors.first?.error ?? "", comment: "Import Error")
+                            ),
+                            primaryButton: .destructive(
+                                Text("OK")
+                            ),
+                            secondaryButton: .cancel()
+                        )
+                    }
                 }
 
                 Section {
@@ -110,8 +114,9 @@ extension NightscoutConfig {
                         }
                     }
                     .disabled(state.url.isEmpty || state.connecting || state.backfilling)
-                } header: { Text("Backfill glucose from Nightscout")
                 }
+                header: { Text("Backfill glucose from Nightscout")
+                }.listRowBackground(Color.chart)
             }
             .navigationBarTitle("Nightscout Config")
             .navigationBarTitleDisplayMode(.automatic)

+ 7 - 4
FreeAPS/Sources/Modules/NightscoutConfig/View/NightscoutConnectView.swift

@@ -52,18 +52,21 @@ struct NightscoutConnectView: View {
                         ProgressView()
                     }
                 }
-            }
+            }.listRowBackground(Color.chart)
+
             Section {
                 Button("Connect to Nightscout") { state.connect() }
                     .disabled(state.url.isEmpty || state.connecting)
                 Button("Delete") { state.delete() }.foregroundColor(.red).disabled(state.connecting)
-            }
+            }.listRowBackground(Color.chart)
+
             Section {
                 Button("Open Nightscout") {
                     UIApplication.shared.open(URL(string: state.url)!, options: [:], completionHandler: nil)
                 }
                 .disabled(state.url.isEmpty || state.connecting)
-            }
+            }.listRowBackground(Color.chart)
+
             Section {
                 Toggle("Use local glucose server", isOn: $state.useLocalSource)
                 HStack {
@@ -76,7 +79,7 @@ struct NightscoutConnectView: View {
                         allowDecimalSeparator: false
                     )
                 }
-            } header: { Text("Local glucose source") }
+            } header: { Text("Local glucose source") }.listRowBackground(Color.chart)
         }
         .navigationTitle("Connect")
         .scrollContentBackground(.hidden).background(color)

+ 3 - 2
FreeAPS/Sources/Modules/NightscoutConfig/View/NightscoutFetchView.swift

@@ -37,7 +37,8 @@ struct NightscoutFetchView: View {
                 Text(
                     "The Fetch Treatments toggle enables fetching of carbs and temp targets entered in Careportal or by another uploading device than Trio."
                 )
-            }
+            }.listRowBackground(Color.chart)
+
             Section(
                 header: Text("Allow Remote control of Trio"),
                 footer: VStack(alignment: .leading, spacing: 2) {
@@ -52,7 +53,7 @@ struct NightscoutFetchView: View {
                 {
                     Toggle("Remote Control", isOn: $state.allowAnnouncements)
                         .disabled(!state.isDownloadEnabled)
-                }
+                }.listRowBackground(Color.chart)
         }
         .navigationTitle("Fetch and Remote")
         .scrollContentBackground(.hidden).background(color)

+ 1 - 1
FreeAPS/Sources/Modules/NightscoutConfig/View/NightscoutUploadView.swift

@@ -41,7 +41,7 @@ struct NightscoutUploadView: View {
                     Toggle("Upload Treatments and Settings", isOn: $state.isUploadEnabled)
 
                     Toggle("Upload Glucose", isOn: $state.uploadGlucose).disabled(!state.changeUploadGlucose)
-                }
+                }.listRowBackground(Color.chart)
         }
         .navigationTitle("Upload")
         .scrollContentBackground(.hidden).background(color)

+ 1 - 1
FreeAPS/Sources/Modules/Settings/View/SettingsRootView.swift

@@ -250,7 +250,7 @@ extension Settings {
                     }
                 }
                 // TODO: check how to implement intuitive search
-//                .searchable(text: $searchText, placement: .navigationBarDrawer(displayMode: .always))
+//                .searchable(text: $searchText, placement: .navigationBarDrawer(displayMode: .automatic))
                 .onDisappear(perform: { state.uploadProfileAndSettings(false) })
                 .screenNavigation(self)
         }

+ 2 - 2
Trio.xcworkspace/xcshareddata/swiftpm/Package.resolved

@@ -1,5 +1,5 @@
 {
-  "originHash" : "59ac7eba66375d6eb406e758cb0b9964f4b3b0ae45c5665596f00384c32262b9",
+  "originHash" : "f5c836c216c4ca7d356e3777e58d6d4f9502b03f3974891349eb775f4c4cf750",
   "pins" : [
     {
       "identity" : "cryptoswift",
@@ -49,7 +49,7 @@
     {
       "identity" : "swiftcharts",
       "kind" : "remoteSourceControl",
-      "location" : "https://github.com/ivanschuetz/SwiftCharts.git",
+      "location" : "https://github.com/ivanschuetz/SwiftCharts",
       "state" : {
         "branch" : "master",
         "revision" : "c354c1945bb35a1f01b665b22474f6db28cba4a2"