Give the tvOS network share discovery sheet a focusable Cancel

The toolbar Cancel is iOS/macOS only, so while scanning with no shares
found yet (and when discovery is unavailable) the tvOS sheet had nothing
the remote could focus.
This commit is contained in:
Arkadiusz Fal
2026-10-17 15:23:00 +02:00
parent eec39445b4
commit f393d2b9cc

View File

@@ -72,6 +72,15 @@ struct NetworkShareDiscoverySheet: View {
Text(String(localized: "discovery.scanning"))
.foregroundStyle(.secondary)
}
#if os(tvOS)
// The toolbar Cancel is iOS/macOS only. Until a share
// turns up, this is the only thing the remote can focus.
Button(String(localized: "common.cancel")) {
service.stopDiscovery()
dismiss()
}
#endif
}
}
@@ -133,6 +142,12 @@ struct NetworkShareDiscoverySheet: View {
Label(String(localized: "discovery.unavailable.title"), systemImage: "exclamationmark.triangle")
} description: {
Text(String(localized: "discovery.unavailable.description"))
} actions: {
#if os(tvOS)
Button(String(localized: "common.cancel")) {
dismiss()
}
#endif
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
}