mirror of
https://github.com/wu736139669/hapi.git
synced 2026-12-05 07:07:04 +00:00
Session rows now match the web sidebar: the second line shows the last two path components, active shares get a "Shared" pill, relative ages read like the H5 list (now, 5 min ago, 10 hours ago, 2 days ago, then a date), and the list font scale reaches 60%. The running spinner is drawn from a timeline instead of ProgressView: UIKit-backed spinners stop animating when a List cell is reconfigured, which read as a spinner that often failed. Working rows also keep their spinner while a pending approval is shown, as on web. Queued-message actions no longer look dead. Cancelling a row the hub reports as `busy` because it is already indeterminate used to restore the row unchanged; it now keeps a `queueDismissed` hold (web #1839), so Cancel and Retry take effect while the durable record stays available for a late consume. Steer is hidden for flavors that cannot take it (agy needs acp, cursor needs acp) via a port of the web steering gate. via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run>
41 lines
1.4 KiB
Swift
41 lines
1.4 KiB
Swift
import Foundation
|
|
import HapiProtocol
|
|
|
|
/// Public session shares (`hub/src/web/routes/sessionShares.ts`). Creating a
|
|
/// share returns the six-digit access code once; later reads only return the
|
|
/// link token, so the UI must keep the code from the create response.
|
|
extension APIClient {
|
|
public func createSessionShare(sessionId: String) async throws -> SessionShareCreateResponse {
|
|
struct CreateRequest: Encodable {
|
|
let sessionId: String
|
|
}
|
|
return try await request(
|
|
.post,
|
|
"/api/session-shares",
|
|
body: CreateRequest(sessionId: sessionId)
|
|
)
|
|
}
|
|
|
|
public func sessionShare(sessionId: String) async throws -> SessionShare? {
|
|
let response: SessionShareEnvelope = try await request(
|
|
.get,
|
|
"/api/session-shares/session/\(encodePathComponent(sessionId))"
|
|
)
|
|
return response.share
|
|
}
|
|
|
|
/// `GET /api/session-shares` — active shares in this namespace, for the
|
|
/// list's "Shared" marks.
|
|
public func sessionShares() async throws -> [SessionShare] {
|
|
let response: SessionShareListResponse = try await request(.get, "/api/session-shares")
|
|
return response.shares.map(\.share)
|
|
}
|
|
|
|
public func revokeSessionShare(id: String) async throws {
|
|
try await requestVoid(
|
|
.delete,
|
|
"/api/session-shares/\(encodePathComponent(id))"
|
|
)
|
|
}
|
|
}
|