mirror of
https://github.com/yattee/yattee.git
synced 2026-10-23 13:12: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
|
let instance: Instance
|
||||||
|
|
||||||
@Environment(\.appEnvironment) private var appEnvironment
|
@Environment(\.appEnvironment) private var appEnvironment
|
||||||
|
#if os(tvOS)
|
||||||
|
@Environment(\.dismiss) private var dismiss
|
||||||
|
#endif
|
||||||
|
|
||||||
@State private var playlists: [Playlist] = []
|
@State private var playlists: [Playlist] = []
|
||||||
@State private var importedPlaylistIDs: Set<String> = []
|
@State private var importedPlaylistIDs: Set<String> = []
|
||||||
@@ -177,11 +180,19 @@ struct ImportPlaylistsView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var emptyView: some View {
|
private var emptyView: some View {
|
||||||
ContentUnavailableView(
|
ContentUnavailableView {
|
||||||
String(localized: "import.playlists.emptyTitle"),
|
Label(String(localized: "import.playlists.emptyTitle"), systemImage: "list.bullet.rectangle")
|
||||||
systemImage: "list.bullet.rectangle",
|
} description: {
|
||||||
description: Text(String(localized: "import.playlists.emptyDescription"))
|
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)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
.accessibilityIdentifier(AccessibilityID.emptyState)
|
.accessibilityIdentifier(AccessibilityID.emptyState)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ struct ImportSubscriptionsView: View {
|
|||||||
let instance: Instance
|
let instance: Instance
|
||||||
|
|
||||||
@Environment(\.appEnvironment) private var appEnvironment
|
@Environment(\.appEnvironment) private var appEnvironment
|
||||||
|
#if os(tvOS)
|
||||||
|
@Environment(\.dismiss) private var dismiss
|
||||||
|
#endif
|
||||||
|
|
||||||
@State private var channels: [Channel] = []
|
@State private var channels: [Channel] = []
|
||||||
@State private var subscribedChannelIDs: Set<String> = []
|
@State private var subscribedChannelIDs: Set<String> = []
|
||||||
@@ -133,11 +136,19 @@ struct ImportSubscriptionsView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var emptyView: some View {
|
private var emptyView: some View {
|
||||||
ContentUnavailableView(
|
ContentUnavailableView {
|
||||||
String(localized: "import.subscriptions.emptyTitle"),
|
Label(String(localized: "import.subscriptions.emptyTitle"), systemImage: "person.2.slash")
|
||||||
systemImage: "person.2.slash",
|
} description: {
|
||||||
description: Text(String(localized: "import.subscriptions.emptyDescription"))
|
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)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
.accessibilityIdentifier(AccessibilityID.emptyState)
|
.accessibilityIdentifier(AccessibilityID.emptyState)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user