Ivan Valkou 4 лет назад
Родитель
Сommit
2c29d12dcc

+ 6 - 3
FreeAPS/Sources/Modules/Home/View/Header/PumpView.swift

@@ -32,8 +32,11 @@ struct PumpView: View {
                     if reservoir == 0xDEAD_BEEF {
                         Text("50+ " + NSLocalizedString("U", comment: "Insulin unit")).font(.system(size: 12, weight: .bold))
                     } else {
-                        Text(reservoirFormatter.string(from: reservoir as NSNumber)! + NSLocalizedString(" U", comment: "Insulin unit"))
-                            .font(.system(size: 12, weight: .bold))
+                        Text(
+                            reservoirFormatter
+                                .string(from: reservoir as NSNumber)! + NSLocalizedString(" U", comment: "Insulin unit")
+                        )
+                        .font(.system(size: 12, weight: .bold))
                     }
                 }
             }
@@ -75,7 +78,7 @@ struct PumpView: View {
 
         if days >= 1 {
             return "\(days)" + NSLocalizedString("d", comment: "abbreviation for days") + " \(hours)" +
-            NSLocalizedString("h", comment: "abbreviation for hours")
+                NSLocalizedString("h", comment: "abbreviation for hours")
         }
 
         if hours >= 1 {

+ 1 - 1
FreeAPS/Sources/Modules/PreferencesEditor/View/PreferencesEditorRootView.swift

@@ -63,7 +63,7 @@ extension PreferencesEditor {
                     }
                 }
                 Section {
-                    Text("Edit settings json").chevronCell()
+                    Text("Edit settings json")
                         .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.settings), from: self)
                 }
             }

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

@@ -12,86 +12,86 @@ extension Settings {
                 }
 
                 Section(header: Text("Devices")) {
-                    Text("Pump").chevronCell().navigationLink(to: .pumpConfig, from: self)
+                    Text("Pump").navigationLink(to: .pumpConfig, from: self)
                 }
 
                 Section(header: Text("Services")) {
-                    Text("Nightscout").chevronCell().navigationLink(to: .nighscoutConfig, from: self)
+                    Text("Nightscout").navigationLink(to: .nighscoutConfig, from: self)
                 }
 
                 Section(header: Text("Configuration")) {
-                    Text("Preferences").chevronCell().navigationLink(to: .preferencesEditor, from: self)
-                    Text("Pump Settings").chevronCell().navigationLink(to: .pumpSettingsEditor, from: self)
-                    Text("Basal Profile").chevronCell().navigationLink(to: .basalProfileEditor, from: self)
-                    Text("Insulin Sensitivities").chevronCell().navigationLink(to: .isfEditor, from: self)
-                    Text("Carb Ratios").chevronCell().navigationLink(to: .crEditor, from: self)
-                    Text("Target Ranges").chevronCell().navigationLink(to: .targetsEditor, from: self)
-                    Text("Autotune").chevronCell().navigationLink(to: .autotuneConfig, from: self)
+                    Text("Preferences").navigationLink(to: .preferencesEditor, from: self)
+                    Text("Pump Settings").navigationLink(to: .pumpSettingsEditor, 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 Ranges").navigationLink(to: .targetsEditor, from: self)
+                    Text("Autotune").navigationLink(to: .autotuneConfig, from: self)
                 }
 
                 if viewModel.debugOptions {
                     Section(header: Text("Config files")) {
                         Group {
-                            Text("Preferences").chevronCell()
+                            Text("Preferences")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Settings.preferences), from: self)
-                            Text("Pump Settings").chevronCell()
+                            Text("Pump Settings")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Settings.settings), from: self)
-                            Text("Autosense").chevronCell()
+                            Text("Autosense")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Settings.autosense), from: self)
-                            Text("Pump History").chevronCell()
+                            Text("Pump History")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Monitor.pumpHistory), from: self)
-                            Text("Basal profile").chevronCell()
+                            Text("Basal profile")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Settings.basalProfile), from: self)
-                            Text("Targets ranges").chevronCell()
+                            Text("Targets ranges")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Settings.bgTargets), from: self)
-                            Text("Carb ratios").chevronCell()
+                            Text("Carb ratios")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Settings.carbRatios), from: self)
-                            Text("Insulin sensitivities").chevronCell()
+                            Text("Insulin sensitivities")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Settings.insulinSensitivities), from: self)
-                            Text("Temp targets").chevronCell()
+                            Text("Temp targets")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Settings.tempTargets), from: self)
-                            Text("Meal").chevronCell()
+                            Text("Meal")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Monitor.meal), from: self)
                         }
 
                         Group {
-                            Text("IOB").chevronCell()
+                            Text("IOB")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Monitor.iob), from: self)
-                            Text("Pump profile").chevronCell()
+                            Text("Pump profile")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Settings.pumpProfile), from: self)
-                            Text("Profile").chevronCell()
+                            Text("Profile")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Settings.profile), from: self)
-                            Text("Glucose").chevronCell()
+                            Text("Glucose")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Monitor.glucose), from: self)
-                            Text("Carbs").chevronCell()
+                            Text("Carbs")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Monitor.carbHistory), from: self)
-                            Text("Suggested").chevronCell()
+                            Text("Suggested")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Enact.suggested), from: self)
-                            Text("Enacted").chevronCell()
+                            Text("Enacted")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Enact.enacted), from: self)
-                            Text("Announcements").chevronCell()
+                            Text("Announcements")
                                 .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.announcements), from: self)
-                            Text("Enacted announcements").chevronCell()
+                            Text("Enacted announcements")
                                 .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.announcementsEnacted), from: self)
-                            Text("Autotune").chevronCell()
+                            Text("Autotune")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Settings.autotune), from: self)
                         }
 
                         Group {
-                            Text("Target presets").chevronCell()
+                            Text("Target presets")
                                 .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.tempTargetsPresets), from: self)
-                            Text("Middleware").chevronCell()
+                            Text("Middleware")
                                 .navigationLink(to: .configEditor(file: OpenAPS.Middleware.determineBasal), from: self)
                         }
                     }
                 }
 
                 Section {
-                    Text("Share logs").chevronCell()
+                    Text("Share logs")
                         .onTapGesture {
                             showShareSheet = true
                         }
-//                    Text("Read disclaimer").chevronCell()
+//                    Text("Read disclaimer")
 //                        .onTapGesture {
 //                            viewModel.logout()
 //                        }

+ 1 - 18
FreeAPS/Sources/Views/ViewModifiers.swift

@@ -69,10 +69,7 @@ struct Link<T>: ViewModifier where T: View {
     }
 
     func body(content: Content) -> some View {
-        ZStack {
-            NavigationLink(destination: NavigationLazyView(destination().asAny(), screen: screen)) {
-                EmptyView()
-            }.hidden()
+        NavigationLink(destination: NavigationLazyView(destination().asAny(), screen: screen)) {
             content
         }
     }
@@ -124,16 +121,6 @@ struct ClearButton: ViewModifier {
     }
 }
 
-struct ChevronCell: ViewModifier {
-    func body(content: Content) -> some View {
-        HStack {
-            content
-            Spacer()
-            Image(systemName: "chevron.forward").foregroundColor(.secondary)
-        }.contentShape(Rectangle())
-    }
-}
-
 extension View {
     func roundedBackground() -> some View {
         modifier(RoundedBackground())
@@ -158,8 +145,4 @@ extension View {
     }
 
     func asAny() -> AnyView { .init(self) }
-
-    func chevronCell() -> some View {
-        modifier(ChevronCell())
-    }
 }