mirror of
https://github.com/yattee/yattee.git
synced 2026-10-23 05:02:53 +00:00
Give the empty tvOS import screens a focusable Done button
With nothing to import, the playlists and subscriptions import screens had no focusable content; only the container's toolbar Done, which is not a dependable focus target on tvOS.
This commit is contained in:
@@ -11,6 +11,9 @@ struct ImportPlaylistsView: View {
|
||||
let instance: Instance
|
||||
|
||||
@Environment(\.appEnvironment) private var appEnvironment
|
||||
#if os(tvOS)
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
#endif
|
||||
|
||||
@State private var playlists: [Playlist] = []
|
||||
@State private var importedPlaylistIDs: Set<String> = []
|
||||
@@ -177,11 +180,19 @@ struct ImportPlaylistsView: View {
|
||||
}
|
||||
|
||||
private var emptyView: some View {
|
||||
ContentUnavailableView(
|
||||
String(localized: "import.playlists.emptyTitle"),
|
||||
systemImage: "list.bullet.rectangle",
|
||||
description: Text(String(localized: "import.playlists.emptyDescription"))
|
||||
)
|
||||
ContentUnavailableView {
|
||||
Label(String(localized: "import.playlists.emptyTitle"), systemImage: "list.bullet.rectangle")
|
||||
} description: {
|
||||
Text(String(localized: "import.playlists.emptyDescription"))
|
||||
} actions: {
|
||||
#if os(tvOS)
|
||||
// Nothing in the content is focusable here; the container's
|
||||
// toolbar Done is not something to rely on to keep the remote free.
|
||||
Button(String(localized: "common.done")) {
|
||||
dismiss()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.accessibilityIdentifier(AccessibilityID.emptyState)
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@ struct ImportSubscriptionsView: View {
|
||||
let instance: Instance
|
||||
|
||||
@Environment(\.appEnvironment) private var appEnvironment
|
||||
#if os(tvOS)
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
#endif
|
||||
|
||||
@State private var channels: [Channel] = []
|
||||
@State private var subscribedChannelIDs: Set<String> = []
|
||||
@@ -133,11 +136,19 @@ struct ImportSubscriptionsView: View {
|
||||
}
|
||||
|
||||
private var emptyView: some View {
|
||||
ContentUnavailableView(
|
||||
String(localized: "import.subscriptions.emptyTitle"),
|
||||
systemImage: "person.2.slash",
|
||||
description: Text(String(localized: "import.subscriptions.emptyDescription"))
|
||||
)
|
||||
ContentUnavailableView {
|
||||
Label(String(localized: "import.subscriptions.emptyTitle"), systemImage: "person.2.slash")
|
||||
} description: {
|
||||
Text(String(localized: "import.subscriptions.emptyDescription"))
|
||||
} actions: {
|
||||
#if os(tvOS)
|
||||
// Nothing in the content is focusable here; the container's
|
||||
// toolbar Done is not something to rely on to keep the remote free.
|
||||
Button(String(localized: "common.done")) {
|
||||
dismiss()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.accessibilityIdentifier(AccessibilityID.emptyState)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user