SettingsRootView.swift 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 v\(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. Text("Meal").chevronCell()
  47. .navigationLink(to: .configEditor(file: OpenAPS.Monitor.meal), from: self)
  48. }
  49. Group {
  50. Text("IOB").chevronCell()
  51. .navigationLink(to: .configEditor(file: OpenAPS.Monitor.iob), from: self)
  52. Text("Pump profile").chevronCell()
  53. .navigationLink(to: .configEditor(file: OpenAPS.Settings.pumpProfile), from: self)
  54. Text("Profile").chevronCell()
  55. .navigationLink(to: .configEditor(file: OpenAPS.Settings.profile), from: self)
  56. Text("Glucose").chevronCell()
  57. .navigationLink(to: .configEditor(file: OpenAPS.Monitor.glucose), from: self)
  58. Text("Carbs").chevronCell()
  59. .navigationLink(to: .configEditor(file: OpenAPS.Monitor.carbHistory), from: self)
  60. Text("Suggested").chevronCell()
  61. .navigationLink(to: .configEditor(file: OpenAPS.Enact.suggested), from: self)
  62. Text("Enacted").chevronCell()
  63. .navigationLink(to: .configEditor(file: OpenAPS.Enact.enacted), from: self)
  64. Text("Announcements").chevronCell()
  65. .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.announcements), from: self)
  66. Text("Enacted announcements").chevronCell()
  67. .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.announcementsEnacted), from: self)
  68. Text("Autotune").chevronCell()
  69. .navigationLink(to: .configEditor(file: OpenAPS.Settings.autotune), from: self)
  70. }
  71. }
  72. }
  73. }
  74. .navigationTitle("Settings")
  75. .navigationBarItems(leading: Button("Close", action: viewModel.hideModal))
  76. .navigationBarTitleDisplayMode(.automatic)
  77. }
  78. }
  79. }