mirror of
https://github.com/wu736139669/hapi.git
synced 2026-12-04 06:57:55 +00:00
feat(ios): jump notifications and session rows to the pending request
Complete the pending-request center's entry points: - Push payloads already carry the request id for permission and input pushes; the notification tap now passes it through AppModel into the home screen instead of only the session id. - Opening a session row whose summary still has pending requests lands on the first wait (async questions first, since they live in the collapsible bottom panel; approvals scroll to their tool row). - ChatModel queues the jump until the detail's request dictionary arrives, so a cold notification start does not drop the target and a blocking target waits for the transcript to settle before scrolling. - A focus token lets the split detail re-fire for the session that is already open. Routing and pending-target presentation tests cover the new request id. via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -49,6 +49,10 @@ final class AppModel {
|
||||
/// navigation path against the active hub (switched to the owner first,
|
||||
/// see ``openNotificationTarget(sessionId:hubUrl:)``).
|
||||
var pendingOpenSessionId: String?
|
||||
/// Specific pending request carried by the same notification tap
|
||||
/// (`requestId`); nil for a plain ready/tap-to-open push, where the chat
|
||||
/// opens at the first live request when the session has one.
|
||||
var pendingOpenRequestId: String?
|
||||
/// Incremented by `hapicompanion://sessions`; HomeView pops to the list.
|
||||
private(set) var sessionListRequest = 0
|
||||
|
||||
@@ -97,8 +101,12 @@ final class AppModel {
|
||||
activeHubKnowsSession: { [weak self] sessionId in
|
||||
self?.session?.sessionStore.sessions.contains { $0.id == sessionId } ?? false
|
||||
},
|
||||
openSession: { [weak self] sessionId, hubUrl in
|
||||
self?.openNotificationTarget(sessionId: sessionId, hubUrl: hubUrl)
|
||||
openSession: { [weak self] sessionId, hubUrl, requestId in
|
||||
self?.openNotificationTarget(
|
||||
sessionId: sessionId,
|
||||
hubUrl: hubUrl,
|
||||
requestId: requestId
|
||||
)
|
||||
}
|
||||
))
|
||||
}
|
||||
@@ -197,10 +205,15 @@ final class AppModel {
|
||||
|
||||
/// Notification tap: a located owning hub becomes active first, so the
|
||||
/// new home screen consumes the target (`HomeView` is keyed by hub).
|
||||
func openNotificationTarget(sessionId: String, hubUrl: String?) {
|
||||
func openNotificationTarget(
|
||||
sessionId: String,
|
||||
hubUrl: String?,
|
||||
requestId: String? = nil
|
||||
) {
|
||||
if let hubUrl, registry.hubs.contains(hubUrl), hasCredentials(for: hubUrl) {
|
||||
switchHub(to: hubUrl)
|
||||
}
|
||||
pendingOpenRequestId = requestId
|
||||
pendingOpenSessionId = sessionId
|
||||
}
|
||||
|
||||
@@ -249,6 +262,7 @@ final class AppModel {
|
||||
/// hub instead of opening whichever session happened to be first.
|
||||
func openSessionList() {
|
||||
pendingOpenSessionId = nil
|
||||
pendingOpenRequestId = nil
|
||||
sessionListRequest += 1
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user