LoopAPNSRemoteView.swift 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // LoopFollow
  2. // LoopAPNSRemoteView.swift
  3. import SwiftUI
  4. struct LoopAPNSRemoteView: View {
  5. @Environment(\.presentationMode) var presentationMode
  6. @StateObject private var viewModel = RemoteSettingsViewModel()
  7. var body: some View {
  8. NavigationView {
  9. VStack {
  10. let columns = [
  11. GridItem(.flexible(), spacing: 16),
  12. GridItem(.flexible(), spacing: 16),
  13. ]
  14. if viewModel.loopAPNSSetup {
  15. // Show Loop APNS command buttons if APNS setup configured
  16. LazyVGrid(columns: columns, spacing: 16) {
  17. CommandButtonView(command: "Meal", iconName: "fork.knife", destination: LoopAPNSCarbsView())
  18. CommandButtonView(command: "Bolus", iconName: "syringe", destination: LoopAPNSBolusView())
  19. CommandButtonView(command: "Overrides", iconName: "slider.horizontal.3", destination: OverridePresetsView())
  20. }
  21. .padding(.horizontal)
  22. } else {
  23. // Show setup message if APNS is not configured - use full screen
  24. VStack(spacing: 32) {
  25. Spacer()
  26. Image(systemName: "exclamationmark.triangle")
  27. .font(.system(size: 80))
  28. .foregroundColor(.orange)
  29. VStack(spacing: 16) {
  30. Text("Loop APNS Not Configured")
  31. .font(.title2)
  32. .fontWeight(.semibold)
  33. Text("Please configure Loop APNS settings in Remote Settings to use APNS commands.")
  34. .font(.body)
  35. .multilineTextAlignment(.center)
  36. .foregroundColor(.secondary)
  37. .padding(.horizontal, 32)
  38. }
  39. NavigationLink(destination: RemoteSettingsView(viewModel: viewModel)) {
  40. HStack(spacing: 12) {
  41. Image(systemName: "gear")
  42. .font(.system(size: 18))
  43. Text("Configure Loop APNS")
  44. .font(.headline)
  45. }
  46. .padding(.horizontal, 24)
  47. .padding(.vertical, 16)
  48. .background(Color.blue)
  49. .foregroundColor(.white)
  50. .cornerRadius(12)
  51. }
  52. Spacer()
  53. }
  54. .padding(.horizontal, 24)
  55. }
  56. Spacer()
  57. }
  58. .navigationBarTitle("Loop Remote Control", displayMode: .inline)
  59. }
  60. }
  61. }