diff options
Diffstat (limited to 'Hutch/Views/Home/HomeViewModel.swift')
| -rw-r--r-- | Hutch/Views/Home/HomeViewModel.swift | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Hutch/Views/Home/HomeViewModel.swift b/Hutch/Views/Home/HomeViewModel.swift index ec2b324..e9f0f50 100644 --- a/Hutch/Views/Home/HomeViewModel.swift +++ b/Hutch/Views/Home/HomeViewModel.swift @@ -195,6 +195,10 @@ final class HomeViewModel { private let ticketFetchConcurrencyLimit = 6 private let inboxUnreadConcurrencyLimit = 4 + private var currentUserKey: String { + currentUser.canonicalName + } + private static let jobsQuery = """ query jobs { jobs { @@ -392,7 +396,15 @@ final class HomeViewModel { } var hasDashboardContent: Bool { - !projects.isEmpty || !assignedTickets.isEmpty || !recentBuilds.isEmpty || !unreadInboxThreads.isEmpty || systemStatusSnapshot != nil + !pinnedProjects.isEmpty || !assignedTickets.isEmpty || !recentBuilds.isEmpty || !unreadInboxThreads.isEmpty || systemStatusSnapshot != nil + } + + var pinnedProjects: [Project] { + let pinnedIDs = ProjectPinStore.loadPinnedProjectIDs(for: currentUserKey) + guard !pinnedIDs.isEmpty else { return [] } + + let projectsByID = Dictionary(uniqueKeysWithValues: projects.map { ($0.id, $0) }) + return pinnedIDs.compactMap { projectsByID[$0] } } var failedBuildCount: Int { |
