summaryrefslogtreecommitdiff
path: root/Hutch/Views/Inbox/InboxViewModel.swift
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-03-22 20:42:45 -0500
committerChristian Cleberg <[email protected]>2026-03-22 20:42:45 -0500
commit1f8b7a23529462c3c332753d33810b5c9f692bbc (patch)
tree17526dae77a7579b270e6b9cca6224c9020f772d /Hutch/Views/Inbox/InboxViewModel.swift
parente03791d6c15ee0caac033d1b1b390c5d65a69d57 (diff)
downloadhutch-1f8b7a23529462c3c332753d33810b5c9f692bbc.tar.gz
hutch-1f8b7a23529462c3c332753d33810b5c9f692bbc.tar.bz2
hutch-1f8b7a23529462c3c332753d33810b5c9f692bbc.zip
feat: add search to builds, trackers, tickets, pastes, mailing lists, and inbox
Diffstat (limited to 'Hutch/Views/Inbox/InboxViewModel.swift')
-rw-r--r--Hutch/Views/Inbox/InboxViewModel.swift11
1 files changed, 11 insertions, 0 deletions
diff --git a/Hutch/Views/Inbox/InboxViewModel.swift b/Hutch/Views/Inbox/InboxViewModel.swift
index 00d47b5..42ce223 100644
--- a/Hutch/Views/Inbox/InboxViewModel.swift
+++ b/Hutch/Views/Inbox/InboxViewModel.swift
@@ -62,6 +62,7 @@ final class InboxViewModel {
private(set) var threads: [InboxThreadSummary] = []
private(set) var isLoading = false
var error: String?
+ var searchText = ""
private let client: SRHTClient
private let listThreadFetchLimit = 10
@@ -164,6 +165,16 @@ final class InboxViewModel {
threads.first(where: { $0.id == id })
}
+ var filteredThreads: [InboxThreadSummary] {
+ let q = searchText.trimmingCharacters(in: .whitespacesAndNewlines).lowercased()
+ guard !q.isEmpty else { return threads }
+ return threads.filter {
+ $0.displaySubject.lowercased().contains(q) ||
+ $0.listName.lowercased().contains(q) ||
+ $0.latestSender.canonicalName.lowercased().contains(q)
+ }
+ }
+
private func fetchSubscriptions() async throws -> [InboxActivitySubscription] {
var subscriptions: [InboxActivitySubscription] = []
var cursor: String?