diff options
Diffstat (limited to 'Hutch/Views/Home')
| -rw-r--r-- | Hutch/Views/Home/HomeViewModel.swift | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Hutch/Views/Home/HomeViewModel.swift b/Hutch/Views/Home/HomeViewModel.swift index 8762393..ec2b324 100644 --- a/Hutch/Views/Home/HomeViewModel.swift +++ b/Hutch/Views/Home/HomeViewModel.swift @@ -388,6 +388,7 @@ final class HomeViewModel { } isLoadingSystemStatus = false persistNeedsAttentionSnapshot() + persistSystemStatusWidgetSnapshot() } var hasDashboardContent: Bool { @@ -928,6 +929,27 @@ final class HomeViewModel { ) } + private func persistSystemStatusWidgetSnapshot() { + guard let snapshot = systemStatusSnapshot else { + return + } + let widgetSnapshot = SystemStatusWidgetSnapshot( + services: snapshot.services.map { service in + SystemStatusWidgetSnapshot.ServiceEntry( + id: service.id, + name: service.name, + status: service.status.displayName, + requiresAttention: service.status.requiresAttention + ) + }, + hasDisruption: snapshot.hasDisruption, + overallStatusText: snapshot.overallStatusText, + bannerSummary: snapshot.bannerSummary, + updatedAt: .now + ) + SystemStatusWidgetSnapshotStore.save(widgetSnapshot) + } + nonisolated static func buildItems(from jobs: [HomeJobPayload]) -> [HomeBuildItem] { jobs.map { job in let repository = primaryRepositoryReference(in: job.manifest) |
