diff options
| author | Christian Cleberg <[email protected]> | 2026-05-14 13:18:55 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-05-14 13:27:41 -0500 |
| commit | 51b2eb0e6296734960f37cebd40fee34a1f261f9 (patch) | |
| tree | 65063727d8dcff3540818676d7b53288499475dd /Hutch/Views/Lookup/LookupView.swift | |
| parent | 9a853f8777230e0639261b5bc817201ec2d9deca (diff) | |
| download | hutch-51b2eb0e6296734960f37cebd40fee34a1f261f9.tar.gz hutch-51b2eb0e6296734960f37cebd40fee34a1f261f9.tar.bz2 hutch-51b2eb0e6296734960f37cebd40fee34a1f261f9.zip | |
feat: add App Intents for Hutch navigation
- add read-only App Intents for core Hutch workflows
- route intents through the existing Hutch navigation/deep-link model
- expose Work Queue, Recent Activity, System Status, pinned resources, projects, failed builds, assigned tickets, saved searches, and search where supported
- keep App Intents non-mutating for the initial implementation
- preserve existing widget, Safari extension, and hutch:// routing behavior
References: https://todo.sr.ht/~ccleberg/hutch/71
Diffstat (limited to 'Hutch/Views/Lookup/LookupView.swift')
| -rw-r--r-- | Hutch/Views/Lookup/LookupView.swift | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/Hutch/Views/Lookup/LookupView.swift b/Hutch/Views/Lookup/LookupView.swift index 55c421b..6f7ebe1 100644 --- a/Hutch/Views/Lookup/LookupView.swift +++ b/Hutch/Views/Lookup/LookupView.swift @@ -92,11 +92,17 @@ final class LookupViewModel { ) } - init(client: SRHTClient, appState: AppState, defaults: UserDefaults = .standard) { + init( + client: SRHTClient, + appState: AppState, + defaults: UserDefaults = .standard, + initialQuery: String = "" + ) { self.client = client self.appState = appState self.defaults = defaults self.history = LookupHistoryStore.load(defaults: defaults) + self.inputText = initialQuery.trimmingCharacters(in: .whitespacesAndNewlines) } func lookup() async { @@ -329,6 +335,11 @@ final class LookupViewModel { struct LookupView: View { @Environment(AppState.self) private var appState @State private var viewModel: LookupViewModel? + private let initialQuery: String + + init(initialQuery: String = "") { + self.initialQuery = initialQuery + } var body: some View { Group { @@ -341,7 +352,12 @@ struct LookupView: View { .navigationTitle("Look Up") .task { if viewModel == nil { - viewModel = LookupViewModel(client: appState.client, appState: appState, defaults: appState.accountDefaults) + viewModel = LookupViewModel( + client: appState.client, + appState: appState, + defaults: appState.accountDefaults, + initialQuery: initialQuery + ) } } } @@ -427,8 +443,8 @@ struct LookupView: View { } .navigationDestination(for: MoreRoute.self) { route in switch route { - case .lookup: - LookupView() + case .lookup(let query): + LookupView(initialQuery: query ?? "") case .projects: ProjectsListView() case .lists: @@ -445,6 +461,8 @@ struct LookupView: View { AboutView() case .userProfile(let owner): UserProfileDeepLinkView(owner: owner) + case .projectDashboard(let id, let title): + ProjectDashboardDeepLinkView(projectID: id, title: title) case .mailingList(let mailingList): MailingListDetailView(mailingList: mailingList) case .thread(let thread): |
