Keep the tvOS media browser header visible while loading

The Refresh and View Options header was hidden until the first listing
arrived, leaving only a spinner; an SMB or WebDAV connection can hang
for a long time with nothing the remote could focus. Refresh ignores
presses while a load is in flight.
This commit is contained in:
Arkadiusz Fal
2026-10-17 20:22:32 +02:00
parent f393d2b9cc
commit b613b8dbc8

View File

@@ -152,30 +152,32 @@ struct MediaBrowserView: View {
title: navigationTitle
) {
VStack(spacing: 0) {
if !(isLoading && files.isEmpty) {
HStack(spacing: 24) {
Button {
Task { await loadFiles() }
} label: {
Label(String(localized: "common.refresh"), systemImage: "arrow.clockwise")
}
Button {
showViewOptions = true
} label: {
Label(
String(localized: "viewOptions.title"),
systemImage: showOnlyPlayable
? "line.3.horizontal.decrease.circle.fill"
: "line.3.horizontal.decrease.circle"
)
}
Spacer()
// Shown while the first listing loads too: an SMB or WebDAV
// connection can hang for a long time, and the spinner alone
// gives the remote nothing to focus.
HStack(spacing: 24) {
Button {
guard !isLoading else { return }
Task { await loadFiles() }
} label: {
Label(String(localized: "common.refresh"), systemImage: "arrow.clockwise")
}
.padding(.horizontal, 24)
.padding(.top, 16)
.padding(.bottom, 8)
.focusSection()
Button {
showViewOptions = true
} label: {
Label(
String(localized: "viewOptions.title"),
systemImage: showOnlyPlayable
? "line.3.horizontal.decrease.circle.fill"
: "line.3.horizontal.decrease.circle"
)
}
Spacer()
}
.padding(.horizontal, 24)
.padding(.top, 16)
.padding(.bottom, 8)
.focusSection()
inner
.focusSection()
}