fix(ios): hide steady connection chip; drop blank empty-header section band (device feedback)

This commit is contained in:
weishu
2026-08-18 16:42:27 +08:00
parent 41c0db1aad
commit 3300be929d
2 changed files with 34 additions and 12 deletions
+20 -9
View File
@@ -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 {
@@ -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)
}
}
}
}