PodDiagnostics.swift 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //
  2. // PodDiagnotics.swift
  3. // OmniKit
  4. //
  5. // Created by Joseph Moran on 11/25/23.
  6. // Copyright © 2023 LoopKit Authors. All rights reserved.
  7. //
  8. import SwiftUI
  9. import LoopKit
  10. import LoopKitUI
  11. import HealthKit
  12. import OmniKit
  13. struct PodDiagnosticsView: View {
  14. var title: String
  15. @ObservedObject var viewModel: OmnipodSettingsViewModel
  16. var body: some View {
  17. List {
  18. NavigationLink(destination: ReadPodStatusView(toRun: viewModel.readPodStatus)) {
  19. FrameworkLocalText("Read Pod Status", comment: "Text for read pod status navigation link")
  20. .foregroundColor(Color.primary)
  21. }
  22. .disabled(self.viewModel.noPod)
  23. NavigationLink(destination: PlayTestBeepsView(toRun: viewModel.playTestBeeps)) {
  24. FrameworkLocalText("Play Test Beeps", comment: "Text for play test beeps navigation link")
  25. .foregroundColor(Color.primary)
  26. }
  27. .disabled(!self.viewModel.podOk)
  28. NavigationLink(destination: ReadPodInfoView(
  29. title: LocalizedString("Read Pulse Log", comment: "Text for read pulse log title"),
  30. actionString: LocalizedString("Reading Pulse Log...", comment: "Text for read pulse log action"),
  31. failedString: LocalizedString("Failed to read pulse log.", comment: "Alert title for error when reading pulse log"),
  32. toRun: viewModel.readPulseLog))
  33. {
  34. FrameworkLocalText("Read Pulse Log", comment: "Text for read pulse log navigation link")
  35. .foregroundColor(Color.primary)
  36. }
  37. .disabled(self.viewModel.noPod)
  38. NavigationLink(destination: ReadPodInfoView(
  39. title: LocalizedString("Read Pulse Log Plus", comment: "Text for read pulse log plus title"),
  40. actionString: LocalizedString("Reading Pulse Log Plus...", comment: "Text for read pulse log plus action"),
  41. failedString: LocalizedString("Failed to read pulse log plus.", comment: "Alert title for error when reading pulse log plus"),
  42. toRun: viewModel.readPulseLogPlus))
  43. {
  44. FrameworkLocalText("Read Pulse Log Plus", comment: "Text for read pulse log plus navigation link")
  45. .foregroundColor(Color.primary)
  46. }
  47. .disabled(self.viewModel.noPod)
  48. NavigationLink(destination: ReadPodInfoView(
  49. title: LocalizedString("Read Activation Time", comment: "Text for read activation time title"),
  50. actionString: LocalizedString("Reading Activation Time...", comment: "Text for read activation time action"),
  51. failedString: LocalizedString("Failed to read activation time.", comment: "Alert title for error when reading activation time"),
  52. toRun: self.viewModel.readActivationTime))
  53. {
  54. FrameworkLocalText("Read Activation Time", comment: "Text for read activation time navigation link")
  55. .foregroundColor(Color.primary)
  56. }
  57. .disabled(self.viewModel.noPod)
  58. NavigationLink(destination: ReadPodInfoView(
  59. title: LocalizedString("Read Triggered Alerts", comment: "Text for read triggered alerts title"),
  60. actionString: LocalizedString("Reading Triggered Alerts...", comment: "Text for read triggered alerts action"),
  61. failedString: LocalizedString("Failed to read triggered alerts.", comment: "Alert title for error when reading triggered alerts"),
  62. toRun: self.viewModel.readTriggeredAlerts))
  63. {
  64. FrameworkLocalText("Read Triggered Alerts", comment: "Text for read triggered alerts navigation link")
  65. .foregroundColor(Color.primary)
  66. }
  67. .disabled(self.viewModel.noPod)
  68. NavigationLink(destination: PumpManagerDetailsView(
  69. toRun: self.viewModel.pumpManagerDetails))
  70. {
  71. FrameworkLocalText("Pump Manager Details", comment: "Text for pump manager details navigation link")
  72. .foregroundColor(Color.primary)
  73. }
  74. }
  75. .insetGroupedListStyle()
  76. .navigationBarTitle(title)
  77. }
  78. }