From cb1ea5ea4f163d87053285d3fb7999b12a3558b9 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Sun, 12 Apr 2026 00:15:13 -0500 Subject: harden system status and app reliability --- Hutch/Views/More/MoreView.swift | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'Hutch/Views/More/MoreView.swift') diff --git a/Hutch/Views/More/MoreView.swift b/Hutch/Views/More/MoreView.swift index 284b1ad..6325954 100644 --- a/Hutch/Views/More/MoreView.swift +++ b/Hutch/Views/More/MoreView.swift @@ -7,6 +7,7 @@ struct MoreView: View { ("chat.sr.ht", SRHTWebURL.chat) ] + @State private var viewModel: MoreViewModel? @State private var showAccountSwitcher = false var body: some View { @@ -29,9 +30,14 @@ struct MoreView: View { NavigationLink(value: MoreRoute.pastes) { Label("Pastes", systemImage: "doc.on.clipboard") } - + NavigationLink(value: MoreRoute.systemStatus) { - Label("System Status", systemImage: "server.rack") + SystemStatusSummaryRow( + snapshot: viewModel?.systemStatusSnapshot, + isLoading: viewModel?.isLoadingSystemStatus ?? true, + errorMessage: viewModel?.systemStatusErrorMessage, + isShowingStaleData: viewModel?.isShowingStaleSystemStatus ?? false + ) } } @@ -58,6 +64,12 @@ struct MoreView: View { } } .navigationTitle("More") + .refreshable { + await ensureViewModel().loadSystemStatus(forceRefresh: true) + } + .task { + await ensureViewModel().loadIfNeeded() + } .toolbar { ToolbarItem(placement: .topBarTrailing) { Button { @@ -71,4 +83,15 @@ struct MoreView: View { AccountSwitcherView() } } + + @MainActor + private func ensureViewModel() -> MoreViewModel { + if let viewModel { + return viewModel + } + + let newViewModel = MoreViewModel(repository: appState.systemStatusRepository) + viewModel = newViewModel + return newViewModel + } } -- cgit v1.2.3