TherapySetting+Settings.swift 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // TherapySetting+Settings.swift
  3. // LoopKitUI
  4. //
  5. // Created by Rick Pasetto on 7/14/20.
  6. // Copyright © 2020 LoopKit Authors. All rights reserved.
  7. //
  8. import LoopKit
  9. import SwiftUI
  10. extension TherapySetting {
  11. public var authenticationChallengeDescription: String {
  12. switch self {
  13. default:
  14. // Currently, this is the same no matter what the setting is.
  15. return LocalizedString("Authenticate to save therapy setting", comment: "Authentication hint string for therapy settings")
  16. }
  17. }
  18. @ViewBuilder
  19. public func helpScreen() -> some View {
  20. switch self {
  21. case .glucoseTargetRange:
  22. CorrectionRangeInformationView(onExit: nil, mode: .settings)
  23. case .preMealCorrectionRangeOverride:
  24. CorrectionRangeOverrideInformationView(preset: .preMeal, onExit: nil, mode: .settings)
  25. case .workoutCorrectionRangeOverride:
  26. CorrectionRangeOverrideInformationView(preset: .workout, onExit: nil, mode: .settings)
  27. case .suspendThreshold:
  28. SuspendThresholdInformationView(onExit: nil, mode: .settings)
  29. case .basalRate(let maximumScheduleEntryCount):
  30. BasalRatesInformationView(onExit: nil, mode: .settings, maximumScheduleEntryCount: maximumScheduleEntryCount)
  31. case .deliveryLimits:
  32. DeliveryLimitsInformationView(onExit: nil, mode: .settings)
  33. case .insulinModel:
  34. InsulinModelInformationView(onExit: nil, mode: .settings)
  35. case .carbRatio:
  36. CarbRatioInformationView(onExit: nil, mode: .settings)
  37. case .insulinSensitivity:
  38. InsulinSensitivityInformationView(onExit: nil, mode: .settings)
  39. case .none:
  40. Text("To be implemented")
  41. }
  42. }
  43. }