mirror of
https://github.com/wu736139669/hapi.git
synced 2026-12-03 06:47:03 +00:00
fix(ios): hide steady connection chip; drop blank empty-header section band (device feedback)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user