NightscoutFetchView.swift 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import SwiftUI
  2. struct NightscoutFetchView: View {
  3. @ObservedObject var state: NightscoutConfig.StateModel
  4. var body: some View {
  5. Form {
  6. Section {
  7. Toggle("Fetch Treatments", isOn: $state.isDownloadEnabled)
  8. .onChange(of: state.isDownloadEnabled) { newValue in
  9. if !newValue {
  10. state.allowAnnouncements = false
  11. }
  12. }
  13. } header: {
  14. Text("Allow Fetching from Nightscout")
  15. } footer: {
  16. Text(
  17. "The Fetch Treatments toggle enables fetching of carbs and temp targets entered in Careportal or by another uploading device than Trio."
  18. )
  19. }
  20. Section(
  21. header: Text("Allow Remote control of Trio"),
  22. footer: VStack(alignment: .leading, spacing: 2) {
  23. Text("Fetch Treatments needs to be allowed to be able to toggle on Remote Control.")
  24. Text("\nWhen enabled you allow these remote functions through announcements from Nightscout:")
  25. Text(" • ") + Text("Suspend/Resume Pump")
  26. Text(" • ") + Text("Opening/Closing Loop")
  27. Text(" • ") + Text("Set Temp Basal")
  28. Text(" • ") + Text("Enact Bolus")
  29. }
  30. )
  31. {
  32. Toggle("Remote Control", isOn: $state.allowAnnouncements)
  33. .disabled(!state.isDownloadEnabled)
  34. }
  35. }
  36. .navigationTitle("Fetch and Remote")
  37. }
  38. }