diff --git a/LoopCaregiver/LoopCaregiverWatchApp/ContentView.swift b/LoopCaregiver/LoopCaregiverWatchApp/ContentView.swift index 0f2b5a10..ab2a163c 100644 --- a/LoopCaregiver/LoopCaregiverWatchApp/ContentView.swift +++ b/LoopCaregiver/LoopCaregiverWatchApp/ContentView.swift @@ -24,21 +24,26 @@ struct ContentView: View { @State private var path = NavigationPath() var body: some View { + let _ = Self._printChanges() NavigationStack(path: $path) { VStack { if let looperService = accountService.selectedLooperService { HomeView(connectivityManager: watchService, accountService: accountService, looperService: looperService) } else { Text("Open Caregiver Settings on your iPhone and tap 'Setup Watch'") - NavigationLink { - WatchSettingsView( - connectivityManager: watchService, - accountService: accountService, - settings: settings - ) - } label: { - Label("Settings", systemImage: "gear") - } + .toolbar { + ToolbarItem(placement: .topBarLeading) { + NavigationLink { + WatchSettingsView( + connectivityManager: watchService, + accountService: accountService, + settings: settings + ) + } label: { + Label("Settings", systemImage: "gear") + } + } + } } } .alert(deepLinkErrorText, isPresented: $deepLinkErrorShowing) { diff --git a/LoopCaregiver/LoopCaregiverWatchApp/HomeView.swift b/LoopCaregiver/LoopCaregiverWatchApp/HomeView.swift index f13fc3cb..75822637 100644 --- a/LoopCaregiver/LoopCaregiverWatchApp/HomeView.swift +++ b/LoopCaregiver/LoopCaregiverWatchApp/HomeView.swift @@ -28,50 +28,25 @@ struct HomeView: View { } var body: some View { - Group { - switch glucoseTimelineEntry { - case .success(let glucoseTimelineValue): - GeometryReader { geometryProxy in - List { - NightscoutChartScrollView(settings: settings, remoteDataSource: remoteDataSource, compactMode: true) - .frame(height: geometryProxy.size.height * 0.75) - .listRowBackground(Color.clear) - .listRowInsets(.none) - if let (override, status) = glucoseTimelineValue.treatmentData.overrideAndStatus { - NavigationLink { - Text("Override Control Coming Soon...") - } label: { - Label { - if status.active { - Text(override.presentableDescription()) - } else { - Text("Overrides") - } - } icon: { - workoutImage(isActive: status.active) - .renderingMode(.template) - .resizable() - .aspectRatio(contentMode: .fit) - .foregroundColor(.blue) - .accessibilityLabel(Text("Workout")) - } - } - } - NavigationLink { - WatchSettingsView( - connectivityManager: connectivityManager, - accountService: accountService, - settings: settings - ) - } label: { - Label("Settings", systemImage: "gear") - } - } - .listRowInsets(.none) + let _ = Self._printChanges() + GeometryReader { geometryProxy in + List { + graphRowView() + .frame(height: geometryProxy.size.height * 0.75) + .listRowBackground(Color.clear) + NavigationLink { + Text("Override Control Coming Soon...") + } label: { + overrideRowView() } - case .failure(let glucoseTimeLineEntryError): - if !remoteDataSource.updating { - Text(glucoseTimeLineEntryError.localizedDescription) + NavigationLink { + WatchSettingsView( + connectivityManager: connectivityManager, + accountService: accountService, + settings: settings + ) + } label: { + Label("Settings", systemImage: "gear") } } } @@ -86,6 +61,46 @@ struct HomeView: View { }) } + @ViewBuilder + func graphRowView() -> some View { + Group { + switch glucoseTimelineEntry { + case .success: + NightscoutChartScrollView(settings: settings, remoteDataSource: remoteDataSource, compactMode: true) + case .failure(let glucoseTimeLineEntryError): + if !remoteDataSource.updating { + Text(glucoseTimeLineEntryError.localizedDescription) + } else { + Text("") + } + } + } + } + + @ViewBuilder func overrideRowView() -> some View { + switch glucoseTimelineEntry { + case .success(let glucoseTimelineValue): + if let (override, status) = glucoseTimelineValue.treatmentData.overrideAndStatus { + Label { + if status.active { + Text(override.presentableDescription()) + } else { + Text("Overrides") + } + } icon: { + workoutImage(isActive: status.active) + .renderingMode(.template) + .resizable() + .aspectRatio(contentMode: .fit) + .foregroundColor(.blue) + .accessibilityLabel(Text("Workout")) + } + } + case .failure: + Text("") + } + } + struct ToolbarButtonView: View { var remoteDataSource: RemoteDataServiceManager var glucoseTimelineEntry: GlucoseTimeLineEntry diff --git a/LoopCaregiverKit/Sources/LoopCaregiverKit/Models/TimelineProviderShared.swift b/LoopCaregiverKit/Sources/LoopCaregiverKit/Models/TimelineProviderShared.swift index dae6bee8..4ea3e097 100644 --- a/LoopCaregiverKit/Sources/LoopCaregiverKit/Models/TimelineProviderShared.swift +++ b/LoopCaregiverKit/Sources/LoopCaregiverKit/Models/TimelineProviderShared.swift @@ -167,7 +167,7 @@ public struct TimelineProviderShared { var errorDescription: String? { switch self { case let .looperNotFound(looperID, looperName, availableCount): - return "The looper for this widget was not found: \(looperName), (\(looperID)) \(availableCount)." + configurationText() + return "The looper for this widget was not found: \(looperName), (\(looperID.dropLast(30))), (\(availableCount))." + configurationText() case .looperNotConfigured: return "No looper is configured for this widget. " + configurationText() case .notReady: diff --git a/LoopCaregiverKit/Sources/LoopCaregiverKitUI/Charts/NightscoutChart/NightscoutChartScrollView.swift b/LoopCaregiverKit/Sources/LoopCaregiverKitUI/Charts/NightscoutChart/NightscoutChartScrollView.swift index a472ee26..709ab136 100644 --- a/LoopCaregiverKit/Sources/LoopCaregiverKitUI/Charts/NightscoutChart/NightscoutChartScrollView.swift +++ b/LoopCaregiverKit/Sources/LoopCaregiverKitUI/Charts/NightscoutChart/NightscoutChartScrollView.swift @@ -39,6 +39,7 @@ public struct NightscoutChartScrollView: View { } public var body: some View { + let _ = Self._printChanges() GeometryReader { containerGeometry in ZoomableScrollView { zoomScrollViewProxy in NightscoutChartView(viewModel: graphViewModel) diff --git a/LoopCaregiverKit/Sources/LoopCaregiverKitUI/Charts/NightscoutChart/NightscoutChartView.swift b/LoopCaregiverKit/Sources/LoopCaregiverKitUI/Charts/NightscoutChart/NightscoutChartView.swift index bbc79e60..76650310 100644 --- a/LoopCaregiverKit/Sources/LoopCaregiverKitUI/Charts/NightscoutChart/NightscoutChartView.swift +++ b/LoopCaregiverKit/Sources/LoopCaregiverKitUI/Charts/NightscoutChart/NightscoutChartView.swift @@ -213,6 +213,7 @@ struct NightscoutChartView: View { let viewModel: NightscoutChartViewModel var body: some View { + let _ = Self._printChanges() Chart { ForEach(viewModel.getTargetDateRangesAndValues(), id: \.range) { dateRangeAndValue in RectangleMark(