summaryrefslogtreecommitdiff
path: root/Hutch/App/DeepLink.swift
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/App/DeepLink.swift
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/App/DeepLink.swift')
-rw-r--r--Hutch/App/DeepLink.swift21
1 files changed, 13 insertions, 8 deletions
diff --git a/Hutch/App/DeepLink.swift b/Hutch/App/DeepLink.swift
index 7467fc8..a0331a0 100644
--- a/Hutch/App/DeepLink.swift
+++ b/Hutch/App/DeepLink.swift
@@ -25,7 +25,7 @@ enum HutchRoute: Equatable, Sendable {
case trackers
case systemStatus
case lookup
- case search(query: String)
+ case search(query: String, type: LookupType?)
case projectDashboard(id: String, title: String?)
init?(url: URL) {
@@ -103,7 +103,8 @@ enum HutchRoute: Equatable, Sendable {
case "lookup":
if let query = queryValue("q"), !query.isEmpty {
- self = .search(query: query)
+ let type = queryValue("type").flatMap(LookupType.init(rawValue:))
+ self = .search(query: query, type: type)
} else {
self = .lookup
}
@@ -148,8 +149,12 @@ enum HutchRoute: Equatable, Sendable {
return Self.makeURL(host: "status")
case .lookup:
return Self.makeURL(host: "lookup")
- case .search(let query):
- return Self.makeURL(host: "lookup", queryItems: [URLQueryItem(name: "q", value: query)])
+ case .search(let query, let type):
+ var items = [URLQueryItem(name: "q", value: query)]
+ if let type {
+ items.append(URLQueryItem(name: "type", value: type.rawValue))
+ }
+ return Self.makeURL(host: "lookup", queryItems: items)
case .projectDashboard(let id, let title):
return Self.makeURL(
host: "projects",
@@ -205,8 +210,8 @@ enum DeepLink: Equatable {
case systemStatus
/// hutch://lookup
case lookup
- /// hutch://lookup?q=<query>
- case search(query: String)
+ /// hutch://lookup?q=<query>&type=<type>
+ case search(query: String, type: LookupType?)
/// hutch://builds?filter=failed
case failedBuilds
/// hutch://projects/<rid>
@@ -253,8 +258,8 @@ enum DeepLink: Equatable {
self = .systemStatus
case .lookup:
self = .lookup
- case .search(let query):
- self = .search(query: query)
+ case .search(let query, let type):
+ self = .search(query: query, type: type)
case .projectDashboard(let id, let title):
self = .projectDashboard(id: id, title: title)
}