summaryrefslogtreecommitdiff
path: root/Hutch/Views
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-08-07 03:06:34 -0500
committerChristian Cleberg <[email protected]>2026-08-07 03:06:34 -0500
commit9c11d69002d71556fea1e2a938e02d4f4d503ea5 (patch)
tree22c3280dca5f85923ddc3cc85bff8751ad46b7fe /Hutch/Views
parent044c33f7f43db1f38d6c44dd8f483298d9efcc06 (diff)
downloadhutch-9c11d69002d71556fea1e2a938e02d4f4d503ea5.tar.gz
hutch-9c11d69002d71556fea1e2a938e02d4f4d503ea5.tar.bz2
hutch-9c11d69002d71556fea1e2a938e02d4f4d503ea5.zip
Expand App Intents: dialogs, search type, mutating intents (#17)
Addresses the three open items on the App Intents ticket: - Check Status / Check Builds now return a spoken/visible dialog alongside their value, so they surface a result in Siri instead of appearing to do nothing. Logic consolidated to always produce a message. - Search Hutch gains a Search Type parameter (user, git/hg repo, mailing list, tracker, build job) threaded through the .search route into Lookup, which pre-selects the type. LookupType now conforms to AppEnum. - Adds mutating intents (not just navigation): Clear Recent Activity and Unpin Resource, backed by RecentActivityStore.clear and a new HomePinStore.removePin. Both act on the active account's storage. Tests cover search-type routing, the blank-query fallback, and pin removal.
Diffstat (limited to 'Hutch/Views')
-rw-r--r--Hutch/Views/Home/HomePinStore.swift15
-rw-r--r--Hutch/Views/Lookup/LookupView.swift17
-rw-r--r--Hutch/Views/More/MoreView.swift2
3 files changed, 28 insertions, 6 deletions
diff --git a/Hutch/Views/Home/HomePinStore.swift b/Hutch/Views/Home/HomePinStore.swift
index e9bffd1..3b00843 100644
--- a/Hutch/Views/Home/HomePinStore.swift
+++ b/Hutch/Views/Home/HomePinStore.swift
@@ -144,6 +144,21 @@ enum HomePinStore {
saveAll(pinsByUser, defaults: defaults)
}
+ static func removePin(
+ id: String,
+ for userKey: String,
+ defaults: UserDefaults = .standard
+ ) {
+ let normalizedUserKey = normalizedUserKey(userKey)
+ guard !normalizedUserKey.isEmpty else { return }
+
+ var pinsByUser = loadAll(defaults: defaults)
+ var pins = normalizedPins(pinsByUser[normalizedUserKey] ?? loadPins(for: normalizedUserKey, defaults: defaults))
+ pins.removeAll { $0.id == id }
+ pinsByUser[normalizedUserKey] = pins
+ saveAll(pinsByUser, defaults: defaults)
+ }
+
static func pinnedProjectIDs(
for userKey: String,
defaults: UserDefaults = .standard
diff --git a/Hutch/Views/Lookup/LookupView.swift b/Hutch/Views/Lookup/LookupView.swift
index 2a26282..89fce5b 100644
--- a/Hutch/Views/Lookup/LookupView.swift
+++ b/Hutch/Views/Lookup/LookupView.swift
@@ -96,13 +96,17 @@ final class LookupViewModel {
client: SRHTClient,
appState: AppState,
defaults: UserDefaults = .standard,
- initialQuery: String = ""
+ initialQuery: String = "",
+ initialType: LookupType? = nil
) {
self.client = client
self.appState = appState
self.defaults = defaults
self.history = LookupHistoryStore.load(defaults: defaults)
self.inputText = initialQuery.trimmingCharacters(in: .whitespacesAndNewlines)
+ if let initialType {
+ self.selectedType = initialType
+ }
}
func lookup() async {
@@ -336,9 +340,11 @@ struct LookupView: View {
@Environment(AppState.self) private var appState
@State private var viewModel: LookupViewModel?
private let initialQuery: String
+ private let initialType: LookupType?
- init(initialQuery: String = "") {
+ init(initialQuery: String = "", initialType: LookupType? = nil) {
self.initialQuery = initialQuery
+ self.initialType = initialType
}
var body: some View {
@@ -356,7 +362,8 @@ struct LookupView: View {
client: appState.client,
appState: appState,
defaults: appState.accountDefaults,
- initialQuery: initialQuery
+ initialQuery: initialQuery,
+ initialType: initialType
)
}
}
@@ -443,8 +450,8 @@ struct LookupView: View {
}
.navigationDestination(for: MoreRoute.self) { route in
switch route {
- case .lookup(let query):
- LookupView(initialQuery: query ?? "")
+ case .lookup(let query, let type):
+ LookupView(initialQuery: query ?? "", initialType: type)
case .projects:
ProjectsListView()
case .lists:
diff --git a/Hutch/Views/More/MoreView.swift b/Hutch/Views/More/MoreView.swift
index ad02077..d6f7d8a 100644
--- a/Hutch/Views/More/MoreView.swift
+++ b/Hutch/Views/More/MoreView.swift
@@ -13,7 +13,7 @@ struct MoreView: View {
var body: some View {
List {
Section("Search") {
- NavigationLink(value: MoreRoute.lookup(query: nil)) {
+ NavigationLink(value: MoreRoute.lookup(query: nil, type: nil)) {
Label("Look Up", systemImage: "magnifyingglass")
}
.themedRow()