SettingsRootView.swift 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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")) {
  8. Toggle("Closed loop", isOn: $viewModel.closedLoop)
  9. }
  10. Section(header: Text("Devices")) {
  11. Text("Pump").chevronCell().modal(for: .pumpConfig, from: self)
  12. }
  13. Section(header: Text("Services")) {
  14. Text("Nightscout").chevronCell().modal(for: .nighscoutConfig, from: self)
  15. }
  16. Section(header: Text("Configuration")) {
  17. Text("Pump Settings").chevronCell().modal(for: .pumpSettingsEditor, from: self)
  18. Text("Basal Profile").chevronCell().modal(for: .basalProfileEditor, from: self)
  19. Text("Insulin Sensitivities").chevronCell().modal(for: .isfEditor, from: self)
  20. Text("Carb Ratios").chevronCell().modal(for: .crEditor, from: self)
  21. Text("Target Ranges").chevronCell().modal(for: .targetsEditor, from: self)
  22. Text("Preferences").chevronCell().modal(for: .preferencesEditor, from: self)
  23. }
  24. Section(header: Text("Config files")) {
  25. Group {
  26. Text("Preferences").chevronCell()
  27. .modal(for: .configEditor(file: OpenAPS.Settings.preferences), from: self)
  28. Text("Pump Settings").chevronCell().modal(for: .configEditor(file: OpenAPS.Settings.settings), from: self)
  29. Text("Autosense").chevronCell().modal(for: .configEditor(file: OpenAPS.Settings.autosense), from: self)
  30. Text("Pump History").chevronCell()
  31. .modal(for: .configEditor(file: OpenAPS.Monitor.pumpHistory), from: self)
  32. Text("Basal profile").chevronCell()
  33. .modal(for: .configEditor(file: OpenAPS.Settings.basalProfile), from: self)
  34. Text("Targets ranges").chevronCell()
  35. .modal(for: .configEditor(file: OpenAPS.Settings.bgTargets), from: self)
  36. Text("Carb ratios").chevronCell().modal(for: .configEditor(file: OpenAPS.Settings.carbRatios), from: self)
  37. Text("Insulin sensitivities").chevronCell()
  38. .modal(for: .configEditor(file: OpenAPS.Settings.insulinSensitivities), from: self)
  39. Text("Temp targets").chevronCell()
  40. .modal(for: .configEditor(file: OpenAPS.Settings.tempTargets), from: self)
  41. }
  42. Group {
  43. Text("Pump profile").chevronCell()
  44. .modal(for: .configEditor(file: OpenAPS.Settings.pumpProfile), from: self)
  45. Text("Profile").chevronCell().modal(for: .configEditor(file: OpenAPS.Settings.profile), from: self)
  46. Text("Glucose").chevronCell().modal(for: .configEditor(file: OpenAPS.Monitor.glucose), from: self)
  47. Text("Carbs").chevronCell().modal(for: .configEditor(file: OpenAPS.Monitor.carbHistory), from: self)
  48. Text("Suggested").chevronCell()
  49. .modal(for: .configEditor(file: OpenAPS.Enact.suggested), from: self)
  50. Text("Enacted").chevronCell()
  51. .modal(for: .configEditor(file: OpenAPS.Enact.enacted), from: self)
  52. }
  53. }
  54. }
  55. .navigationTitle("Settings")
  56. .navigationBarTitleDisplayMode(.automatic)
  57. }
  58. }
  59. }