diff --git a/Normal/Views/Groups/GroupListCardView.swift b/Normal/Views/Groups/GroupListCardView.swift index 063946e..4d62a94 100644 --- a/Normal/Views/Groups/GroupListCardView.swift +++ b/Normal/Views/Groups/GroupListCardView.swift @@ -194,12 +194,14 @@ struct GroupListCardView: View { } private func timedUnblockRow(endDate: Date) -> some View { - HStack(spacing: DS.Spacing.sm) { - Image(systemName: "timer").foregroundStyle(.orange) - Text(timerInterval: .now ... endDate, countsDown: true) - .font(.subheadline.monospacedDigit()) - .foregroundStyle(.secondary) - Spacer() + AdaptiveStack(spacing: DS.Spacing.sm) { + HStack(spacing: DS.Spacing.sm) { + Image(systemName: "timer").foregroundStyle(.orange) + Text(timerInterval: .now ... endDate, countsDown: true) + .font(.subheadline.monospacedDigit()) + .foregroundStyle(.secondary) + } + .frame(maxWidth: .infinity, alignment: .leading) Button { requestAction(.tighten(blockGroup)) } label: { @@ -211,7 +213,7 @@ struct GroupListCardView: View { } private var actionRow: some View { - HStack(spacing: DS.Spacing.md - 2) { + AdaptiveStack(spacing: DS.Spacing.md - 2) { if blockStatus != .all { blockButton } diff --git a/NormalUITests/BlockingUITests.swift b/NormalUITests/BlockingUITests.swift index e58d24a..04a0f13 100644 --- a/NormalUITests/BlockingUITests.swift +++ b/NormalUITests/BlockingUITests.swift @@ -245,6 +245,33 @@ final class BlockingUITests: XCTestCase { XCTAssertTrue(group.contains { $0.contains("Unblocked") }, "\"Unblocked\" should stay one word: \(group)") } + func testGroupTimedUnblockRowKeepsWholeWordsAtTheLargestTextSize() throws { + let app = launch([ + "-uiTestSeedGroupKey", + "-UIPreferredContentSizeCategoryName", "UICTContentSizeCategoryAccessibilityXXXL", + ]) + app.mainTab("Groups").tap() + + let blockButton = app.buttons["group.blockButton"] + require(blockButton, "Group block button should render") + blockButton.tap() + app.buttons["keySelect.blockWithoutKey"].tap() + confirmBypass(app) + + let unblockButton = app.buttons["group.unblockButton"] + require(unblockButton, "Group unblock button should render after blocking") + unblockButton.tap() + app.buttons["keySelect.row.QR"].tap() + let duration = app.buttons["timedUnblock.duration.900"] + require(duration, "Group unblock duration sheet should appear after key scan") + duration.tap() + app.buttons["timedUnblock.confirm"].tap() + + require(app.buttons["Block Now"], "The group card should show the timed unblock") + let lines = try screenLines() + XCTAssertTrue(lines.contains { $0.contains("Block Now") }, "\"Block Now\" should stay on one line: \(lines)") + } + private func screenLines() throws -> [String] { sleep(1) guard let image = XCUIScreen.main.screenshot().image.cgImage else { return [] }