diff --git a/ios/Xum/Screens/Chat/ActivityLine.swift b/ios/Xum/Screens/Chat/ActivityLine.swift index 9a7972d6bdb..f55713b777f 100644 --- a/ios/Xum/Screens/Chat/ActivityLine.swift +++ b/ios/Xum/Screens/Chat/ActivityLine.swift @@ -36,7 +36,6 @@ struct ActivityLine: View { line(c.shown, hidden: c.hidden) } } - .frame(height: XumMetrics.touchTarget) .frame(maxWidth: .infinity, alignment: .leading) } } diff --git a/ios/Xum/Screens/Chat/ChatView.swift b/ios/Xum/Screens/Chat/ChatView.swift index 17c2b0f7267..2503727eafb 100644 --- a/ios/Xum/Screens/Chat/ChatView.swift +++ b/ios/Xum/Screens/Chat/ChatView.swift @@ -778,7 +778,7 @@ struct ChatView: View { @ViewBuilder private func bottomArea(_ store: ChatStore) -> some View { let short = keyboardUp || ChatDock.isShort(transcript: transcriptHeight, docks: docksHeight, expandedDocks: expandedDocksHeight) let docks = ChatDock.visible(presentDocks(store), short: short) - VStack(spacing: 10) { + VStack(spacing: ComposerBottomPadding.gap) { // Shown with the transcript, not before: chips mounting after it would move it. if store.hasLoaded { ObservationScope { ActivityLine(state: activityState(store), open: activityBinding) } diff --git a/ios/Xum/Screens/Chat/ComposerBottomPadding.swift b/ios/Xum/Screens/Chat/ComposerBottomPadding.swift index 62c9b0622b1..a445c7aa2f6 100644 --- a/ios/Xum/Screens/Chat/ComposerBottomPadding.swift +++ b/ios/Xum/Screens/Chat/ComposerBottomPadding.swift @@ -1,11 +1,15 @@ import SwiftUI enum ComposerBottomPadding { + /// The composer's gap to the keyboard, and to the chips and cards stacked above it: the two + /// gaps read as one rhythm (Mike). + static let gap: CGFloat = 8 + /// Above the keyboard the composer keeps 8 pt. Without it the composer reaches into the home /// indicator's room and stops 16 pt above the screen's edge: 8 pt over the whole inset left a /// gap that read as wasted space (Mike). static func value(keyboardUp: Bool, homeIndicatorInset: CGFloat) -> CGFloat { - guard !keyboardUp, homeIndicatorInset > 0 else { return 8 } - return min(8, 16 - homeIndicatorInset) + guard !keyboardUp, homeIndicatorInset > 0 else { return gap } + return min(gap, 16 - homeIndicatorInset) } } diff --git a/ios/XumTests/ActivityChipsTests.swift b/ios/XumTests/ActivityChipsTests.swift index 77fa393cbc4..f980cf57b07 100644 --- a/ios/XumTests/ActivityChipsTests.swift +++ b/ios/XumTests/ActivityChipsTests.swift @@ -1,5 +1,7 @@ import Foundation +import SwiftUI import Testing +import UIKit @testable import Xum private func ws(_ id: String, parent: String?, _ extra: [String: JSONValue] = [:]) -> Workspace { @@ -276,3 +278,17 @@ struct ActivityLineStoreTests { #expect(calls.made.first?.1?["tailBytes"]?.double == Double(BashOutputBuffer.firstTailBytes)) } } + +@MainActor +struct ActivityLineLayoutTests { + /// The stack's spacing is then the whole gap between the chips and the composer, the same + /// gap the composer keeps above the keyboard (#8249). + @Test func theLineIsAsTallAsItsChips() { + let state = ActivityLineState(todos: [TodoItem(content: "Run the drift report", status: "in_progress")], + tray: SubAgentTray(workspaces: [], parentId: "P", activity: [:]), + bashes: [proc("p1")], instructions: nil) + let line = ActivityLine(state: state, open: .constant(nil)).environment(\.dynamicTypeSize, .large) + let size = UIHostingController(rootView: line).sizeThatFits(in: CGSize(width: 390, height: CGFloat.infinity)) + #expect(size.height == ComposerMetrics.chipHeight) + } +}