LowBgAlarmEditor.swift 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // LoopFollow
  2. // LowBgAlarmEditor.swift
  3. import SwiftUI
  4. struct LowBgAlarmEditor: View {
  5. @Binding var alarm: Alarm
  6. var body: some View {
  7. Group {
  8. InfoBanner(text: "This warns you if the glucose is too low now or might be soon, based on predictions. Note: predictions is currently not available for Trio.")
  9. AlarmGeneralSection(alarm: $alarm)
  10. AlarmBGSection(
  11. header: "Low Limit",
  12. footer: "Alert when any reading or prediction is at or below this value.",
  13. title: "BG",
  14. range: 40 ... 150,
  15. value: $alarm.belowBG
  16. )
  17. AlarmStepperSection(
  18. header: "PERSISTENCE",
  19. footer: "Glucose must stay below the threshold for this many minutes "
  20. + "before the alert sounds. Set 0 to alert immediately.",
  21. title: "Persistent",
  22. range: 0 ... 120,
  23. step: 5,
  24. unitLabel: alarm.type.snoozeTimeUnit.label,
  25. value: $alarm.persistentMinutes
  26. )
  27. AlarmStepperSection(
  28. header: "PREDICTION",
  29. footer: "Look ahead this many minutes in Loop’s prediction; "
  30. + "if any future value is at or below the threshold, "
  31. + "you’ll be warned early. Set 0 to disable.",
  32. title: "Predictive",
  33. range: 0 ... 60,
  34. step: 5,
  35. unitLabel: alarm.type.snoozeTimeUnit.label,
  36. value: $alarm.predictiveMinutes
  37. )
  38. Section(
  39. header: Text("RISING BG"),
  40. footer: Text("Stay silent while BG is rising. The alert only sounds "
  41. + "when the latest reading is flat or still falling.")
  42. ) {
  43. Toggle("Skip if BG is rising", isOn: $alarm.suppressIfRising)
  44. }
  45. AlarmActiveSection(alarm: $alarm)
  46. AlarmAudioSection(alarm: $alarm)
  47. AlarmSnoozeSection(alarm: $alarm)
  48. }
  49. }
  50. }