HighBgAlarmEditor.swift 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // LoopFollow
  2. // HighBgAlarmEditor.swift
  3. import SwiftUI
  4. struct HighBgAlarmEditor: View {
  5. @Binding var alarm: Alarm
  6. var body: some View {
  7. Group {
  8. InfoBanner(
  9. text: "Alerts when glucose stays above the limit "
  10. + "you set below. Use Persistent if you want to ignore brief spikes."
  11. )
  12. AlarmGeneralSection(alarm: $alarm)
  13. AlarmBGSection(
  14. header: "High Glucose Limit",
  15. footer: "The alert becomes eligible once any reading is at or above this value.",
  16. title: "BG",
  17. range: 120 ... 350,
  18. value: $alarm.aboveBG
  19. )
  20. AlarmStepperSection(
  21. header: "Persistent High",
  22. footer: "How long glucose must remain above the threshold before the "
  23. + "alarm actually fires. Set to 0 for an immediate alert.",
  24. title: "Persistent for",
  25. range: 0 ... 120,
  26. step: 5,
  27. unitLabel: alarm.type.snoozeTimeUnit.label,
  28. value: $alarm.persistentMinutes
  29. )
  30. Section(
  31. header: Text("FALLING BG"),
  32. footer: Text("Stay silent while BG is falling. The alert only sounds "
  33. + "when the latest reading is flat or still rising.")
  34. ) {
  35. Toggle("Skip if BG is falling", isOn: $alarm.suppressIfFalling)
  36. }
  37. AlarmActiveSection(alarm: $alarm)
  38. AlarmAudioSection(alarm: $alarm)
  39. AlarmSnoozeSection(alarm: $alarm)
  40. }
  41. }
  42. }