Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ios/Xum/Screens/Chat/ActivityLine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ struct ActivityLine: View {
line(c.shown, hidden: c.hidden)
}
}
.frame(height: XumMetrics.touchTarget)
.frame(maxWidth: .infinity, alignment: .leading)
}
}
Expand Down
2 changes: 1 addition & 1 deletion ios/Xum/Screens/Chat/ChatView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down
8 changes: 6 additions & 2 deletions ios/Xum/Screens/Chat/ComposerBottomPadding.swift
Original file line number Diff line number Diff line change
@@ -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)
}
}
16 changes: 16 additions & 0 deletions ios/XumTests/ActivityChipsTests.swift
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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)
}
}
Loading