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
16 changes: 9 additions & 7 deletions Normal/Views/Groups/GroupListCardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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
}
Expand Down
27 changes: 27 additions & 0 deletions NormalUITests/BlockingUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 [] }
Expand Down
Loading