Files
hapi/ios/Hapi/Features/Chat/SessionInfoView.swift
T
cb97565cdf feat(ios): polish chat chrome, session state and text selection
- Decode DSH sessions by accepting workspace-write / danger-full-access
  permission modes (the missing cases made the whole session detail fail to
  decode, so pending ask_user_question requests never reached the card).
- Carry background task snapshots from Session/SessionPatch and let the
  composer chip list the running task descriptions.
- Compact the nav subtitle to project + machine, add a tap-through session
  info sheet, and hide the duplicated status wording.
- Mute archived rows: desaturated agent icon, secondary title, hint-coloured
  detail/timestamp and an archivebox indicator.
- Add a Select Text action backed by a read-only UITextView so arbitrary
  ranges (including cross-paragraph) select with native handles; enable
  inline table selection too.
- Point home widget card taps at their session instead of the list, and keep
  the list link only as the empty fallback.
- Update LastSeen tests for the optimistic read watermark semantics.

via [HAPI](https://hapi.run)

Co-Authored-By: HAPI <noreply@hapi.run>
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-15 21:37:19 +08:00

76 lines
2.5 KiB
Swift

import HapiClient
import HapiUI
import SwiftUI
import UIKit
/// Full session metadata behind the deliberately compact nav subtitle:
/// the subtitle only has room for project + machine on a phone.
struct SessionInfoView: View {
let header: ChatHeaderUI
let sessionId: String
let status: String
@Environment(\.dismiss) private var dismiss
var body: some View {
NavigationStack {
Form {
Section {
row("Status", value: status)
if let path = header.projectPath {
row("Project", value: path, copyable: true)
} else if let project = header.project {
row("Project", value: project)
}
if let machine = header.machine {
row("Machine", value: machine)
}
if let worktree = header.worktree {
row("Worktree", value: worktree)
}
}
Section {
if let model = header.model {
row("Model", value: model)
}
if let effort = header.effort {
row("Effort", value: effort)
}
row("Session ID", value: sessionId, copyable: true)
}
}
.navigationTitle(header.title)
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .confirmationAction) {
Button("Done") { dismiss() }
}
}
}
}
@ViewBuilder
private func row(_ label: LocalizedStringKey, value: String, copyable: Bool = false) -> some View {
LabeledContent {
HStack(spacing: 8) {
Text(verbatim: value)
.multilineTextAlignment(.trailing)
.lineLimit(2)
.truncationMode(.middle)
.textSelection(.enabled)
if copyable {
Button {
UIPasteboard.general.string = value
} label: {
Image(systemName: "doc.on.doc")
}
.buttonStyle(.borderless)
.accessibilityLabel("Copy")
}
}
} label: {
Text(label)
}
}
}