SettingsRootView.swift 5.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import SwiftUI
  2. extension Settings {
  3. struct RootView: BaseView {
  4. @EnvironmentObject var viewModel: ViewModel<Provider>
  5. var body: some View {
  6. Form {
  7. Section(header: Text("FreeAPS X \(viewModel.appVersion) (\(viewModel.buildNumber))")) {
  8. Toggle("Closed loop", isOn: $viewModel.closedLoop)
  9. }
  10. Section(header: Text("Devices")) {
  11. Text("Pump").chevronCell().navigationLink(to: .pumpConfig, from: self)
  12. }
  13. Section(header: Text("Services")) {
  14. Text("Nightscout").chevronCell().navigationLink(to: .nighscoutConfig, from: self)
  15. }
  16. Section(header: Text("Configuration")) {
  17. Text("Preferences").chevronCell().navigationLink(to: .preferencesEditor, from: self)
  18. Text("Pump Settings").chevronCell().navigationLink(to: .pumpSettingsEditor, from: self)
  19. Text("Basal Profile").chevronCell().navigationLink(to: .basalProfileEditor, from: self)
  20. Text("Insulin Sensitivities").chevronCell().navigationLink(to: .isfEditor, from: self)
  21. Text("Carb Ratios").chevronCell().navigationLink(to: .crEditor, from: self)
  22. Text("Target Ranges").chevronCell().navigationLink(to: .targetsEditor, from: self)
  23. Text("Autotune").chevronCell().navigationLink(to: .autotuneConfig, from: self)
  24. }
  25. if viewModel.debugOptions {
  26. Section(header: Text("Config files")) {
  27. Group {
  28. Text("Preferences").chevronCell()
  29. .navigationLink(to: .configEditor(file: OpenAPS.Settings.preferences), from: self)
  30. Text("Pump Settings").chevronCell()
  31. .navigationLink(to: .configEditor(file: OpenAPS.Settings.settings), from: self)
  32. Text("Autosense").chevronCell()
  33. .navigationLink(to: .configEditor(file: OpenAPS.Settings.autosense), from: self)
  34. Text("Pump History").chevronCell()
  35. .navigationLink(to: .configEditor(file: OpenAPS.Monitor.pumpHistory), from: self)
  36. Text("Basal profile").chevronCell()
  37. .navigationLink(to: .configEditor(file: OpenAPS.Settings.basalProfile), from: self)
  38. Text("Targets ranges").chevronCell()
  39. .navigationLink(to: .configEditor(file: OpenAPS.Settings.bgTargets), from: self)
  40. Text("Carb ratios").chevronCell()
  41. .navigationLink(to: .configEditor(file: OpenAPS.Settings.carbRatios), from: self)
  42. Text("Insulin sensitivities").chevronCell()
  43. .navigationLink(to: .configEditor(file: OpenAPS.Settings.insulinSensitivities), from: self)
  44. Text("Temp targets").chevronCell()
  45. .navigationLink(to: .configEditor(file: OpenAPS.Settings.tempTargets), from: self)
  46. }
  47. Group {
  48. Text("IOB").chevronCell()
  49. .navigationLink(to: .configEditor(file: OpenAPS.Monitor.iob), from: self)
  50. Text("Pump profile").chevronCell()
  51. .navigationLink(to: .configEditor(file: OpenAPS.Settings.pumpProfile), from: self)
  52. Text("Profile").chevronCell()
  53. .navigationLink(to: .configEditor(file: OpenAPS.Settings.profile), from: self)
  54. Text("Glucose").chevronCell()
  55. .navigationLink(to: .configEditor(file: OpenAPS.Monitor.glucose), from: self)
  56. Text("Carbs").chevronCell()
  57. .navigationLink(to: .configEditor(file: OpenAPS.Monitor.carbHistory), from: self)
  58. Text("Suggested").chevronCell()
  59. .navigationLink(to: .configEditor(file: OpenAPS.Enact.suggested), from: self)
  60. Text("Enacted").chevronCell()
  61. .navigationLink(to: .configEditor(file: OpenAPS.Enact.enacted), from: self)
  62. Text("Announcements").chevronCell()
  63. .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.announcements), from: self)
  64. Text("Enacted announcements").chevronCell()
  65. .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.announcementsEnacted), from: self)
  66. Text("Autotune").chevronCell()
  67. .navigationLink(to: .configEditor(file: OpenAPS.Settings.autotune), from: self)
  68. }
  69. }
  70. }
  71. }
  72. .navigationTitle("Settings")
  73. .navigationBarItems(leading: Button("Close", action: viewModel.hideModal))
  74. .navigationBarTitleDisplayMode(.automatic)
  75. }
  76. }
  77. }