From 54d037548261c1546555a89a6a803b542a769880 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Sun, 12 Apr 2026 22:30:22 -0500 Subject: feat: add repo settings management Implements: https://todo.sr.ht/~ccleberg/hutch/42 Implements: https://todo.sr.ht/~ccleberg/hutch/43 Implements: https://todo.sr.ht/~ccleberg/hutch/44 --- Hutch/Views/Lookup/UserProfileViewModel.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Hutch/Views/Lookup/UserProfileViewModel.swift') diff --git a/Hutch/Views/Lookup/UserProfileViewModel.swift b/Hutch/Views/Lookup/UserProfileViewModel.swift index 56c2852..b88d36a 100644 --- a/Hutch/Views/Lookup/UserProfileViewModel.swift +++ b/Hutch/Views/Lookup/UserProfileViewModel.swift @@ -61,6 +61,17 @@ final class UserProfileViewModel { } } + func updateRepository(_ repository: RepositorySummary) { + guard let index = repositories.firstIndex(where: { $0.id == repository.id }) else { return } + repositories[index] = repository + repositories.sort { lhs, rhs in + if lhs.updated == rhs.updated { + return lhs.name.localizedCaseInsensitiveCompare(rhs.name) == .orderedAscending + } + return lhs.updated > rhs.updated + } + } + func loadTrackers() async { isLoadingTrackers = true trackersError = nil -- cgit v1.2.3