PhoneBatteryAlarmEditor.swift 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // LoopFollow
  2. // PhoneBatteryAlarmEditor.swift
  3. import SwiftUI
  4. struct PhoneBatteryAlarmEditor: View {
  5. @Binding var alarm: Alarm
  6. var body: some View {
  7. Group {
  8. InfoBanner(
  9. text: "This warns you when the phone's battery gets low, based on the percentage you choose.",
  10. alarmType: alarm.type
  11. )
  12. AlarmGeneralSection(alarm: $alarm)
  13. AlarmStepperSection(
  14. header: "Phone Battery Level",
  15. footer: "This alerts you when the phone battery drops to or below this level.",
  16. title: "At or Below",
  17. range: 0 ... 100,
  18. step: 5,
  19. unitLabel: "%",
  20. value: $alarm.threshold
  21. )
  22. Section(
  23. header: Text("CHARGING"),
  24. footer: Text("Stay silent while the phone is charging. Requires the "
  25. + "uploader to report charging status; if it doesn't, the alert still sounds.")
  26. ) {
  27. Toggle("Skip while charging", isOn: $alarm.suppressIfCharging)
  28. }
  29. AlarmActiveSection(alarm: $alarm)
  30. AlarmAudioSection(alarm: $alarm)
  31. AlarmSnoozeSection(alarm: $alarm)
  32. }
  33. }
  34. }