SettingsRootView.swift 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 settings").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("Targets").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("BG targets").chevronCell().modal(for: .configEditor(file: OpenAPS.Settings.bgTargets), from: self)
  35. Text("Carb ratios").chevronCell().modal(for: .configEditor(file: OpenAPS.Settings.carbRatios), from: self)
  36. Text("Insulin sensitivities").chevronCell()
  37. .modal(for: .configEditor(file: OpenAPS.Settings.insulinSensitivities), from: self)
  38. Text("Temp targets").chevronCell()
  39. .modal(for: .configEditor(file: OpenAPS.Settings.tempTargets), from: self)
  40. }
  41. Group {
  42. Text("Pump profile").chevronCell()
  43. .modal(for: .configEditor(file: OpenAPS.Settings.pumpProfile), from: self)
  44. Text("Profile").chevronCell().modal(for: .configEditor(file: OpenAPS.Settings.profile), from: self)
  45. Text("Glucose").chevronCell().modal(for: .configEditor(file: OpenAPS.Monitor.glucose), from: self)
  46. Text("Carbs").chevronCell().modal(for: .configEditor(file: OpenAPS.Monitor.carbHistory), from: self)
  47. Text("Suggested").chevronCell()
  48. .modal(for: .configEditor(file: OpenAPS.Enact.suggested), from: self)
  49. Text("Enacted").chevronCell()
  50. .modal(for: .configEditor(file: OpenAPS.Enact.enacted), from: self)
  51. }
  52. }
  53. }
  54. .navigationTitle("Settings")
  55. .navigationBarTitleDisplayMode(.automatic)
  56. }
  57. }
  58. }