From 3300be929d01ba58376cd2cf3d0abb45a45de873 Mon Sep 17 00:00:00 2001 From: weishu Date: Tue, 18 Aug 2026 16:42:27 +0800 Subject: [PATCH] fix(ios): hide steady connection chip; drop blank empty-header section band (device feedback) --- ios/Hapi/Features/Home/HomeView.swift | 29 +++++++++++++------ .../Features/Sessions/SessionListView.swift | 17 +++++++++-- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/ios/Hapi/Features/Home/HomeView.swift b/ios/Hapi/Features/Home/HomeView.swift index 2c9de343..7c9462ca 100644 --- a/ios/Hapi/Features/Home/HomeView.swift +++ b/ios/Hapi/Features/Home/HomeView.swift @@ -85,17 +85,28 @@ struct HomeView: View { // MARK: - Connection state + /// Shown only while the stream is NOT healthy: a steady "Live" chip was + /// pure noise and read as a mystery non-button (device feedback). In the + /// degraded states the dot + label explain themselves. + private var connectionDegraded: Bool { + if case .connected = session.connectionState { return false } + return true + } + + @ViewBuilder private var connectionIndicator: some View { - HStack(spacing: 6) { - Circle() - .fill(connectionColor) - .frame(width: 8, height: 8) - Text(connectionLabel) - .font(.footnote) - .foregroundStyle(.secondary) + if connectionDegraded { + HStack(spacing: 6) { + Circle() + .fill(connectionColor) + .frame(width: 8, height: 8) + Text(connectionLabel) + .font(.footnote) + .foregroundStyle(.secondary) + } + .accessibilityElement(children: .combine) + .accessibilityLabel("Connection: \(connectionLabel)") } - .accessibilityElement(children: .combine) - .accessibilityLabel("Connection: \(connectionLabel)") } private var connectionColor: Color { diff --git a/ios/Hapi/Features/Sessions/SessionListView.swift b/ios/Hapi/Features/Sessions/SessionListView.swift index 3c06e8dd..d7cbec3f 100644 --- a/ios/Hapi/Features/Sessions/SessionListView.swift +++ b/ios/Hapi/Features/Sessions/SessionListView.swift @@ -85,9 +85,20 @@ struct SessionListView: View { } } if rows.count > pinnedCount { - Section(pinnedCount > 0 ? String(localized: "Sessions") : "") { - ForEach(rows.dropFirst(pinnedCount)) { row in - rowCell(row, now: now) + // Headerless when nothing is pinned: an empty-string Section + // header still reserves a blank sticky band above the list + // (device feedback: "一片空白"). + if pinnedCount > 0 { + Section(String(localized: "Sessions")) { + ForEach(rows.dropFirst(pinnedCount)) { row in + rowCell(row, now: now) + } + } + } else { + Section { + ForEach(rows) { row in + rowCell(row, now: now) + } } } }