Fix tvOS sidebar media source showing empty screen

This commit is contained in:
Arkadiusz Fal
2026-04-17 03:02:37 +02:00
parent afc4125bee
commit a3275f4cd7

View File

@@ -577,6 +577,7 @@ struct UnifiedTabView: View {
@State private var channelPaths: [String: NavigationPath] = [:] @State private var channelPaths: [String: NavigationPath] = [:]
@State private var playlistPaths: [UUID: NavigationPath] = [:] @State private var playlistPaths: [UUID: NavigationPath] = [:]
@State private var instancePaths: [UUID: NavigationPath] = [:] @State private var instancePaths: [UUID: NavigationPath] = [:]
@State private var mediaSourcePaths: [UUID: NavigationPath] = [:]
@State private var bookmarksPath = NavigationPath() @State private var bookmarksPath = NavigationPath()
@State private var historyPath = NavigationPath() @State private var historyPath = NavigationPath()
@State private var subscriptionsFeedPath = NavigationPath() @State private var subscriptionsFeedPath = NavigationPath()
@@ -783,8 +784,7 @@ struct UnifiedTabView: View {
@TabContentBuilder<SidebarItem> @TabContentBuilder<SidebarItem>
private var sidebarSections: some TabContent<SidebarItem> { private var sidebarSections: some TabContent<SidebarItem> {
// Sources Section (shows configured instances) // Sources Section (shows configured instances and media sources)
// Note: Media sources are only shown on iOS/macOS
if !sidebarManager.sortedSourceItems.isEmpty && (settingsManager?.sidebarSourcesEnabled ?? true) { if !sidebarManager.sortedSourceItems.isEmpty && (settingsManager?.sidebarSourcesEnabled ?? true) {
TabSection(String(localized: "sidebar.section.sources")) { TabSection(String(localized: "sidebar.section.sources")) {
ForEach(sidebarManager.sortedSourceItems) { item in ForEach(sidebarManager.sortedSourceItems) { item in
@@ -916,14 +916,12 @@ extension UnifiedTabView {
) )
} }
#if os(iOS) || os(macOS)
func mediaSourcePathBinding(for id: UUID) -> Binding<NavigationPath> { func mediaSourcePathBinding(for id: UUID) -> Binding<NavigationPath> {
Binding( Binding(
get: { mediaSourcePaths[id] ?? NavigationPath() }, get: { mediaSourcePaths[id] ?? NavigationPath() },
set: { mediaSourcePaths[id] = $0 } set: { mediaSourcePaths[id] = $0 }
) )
} }
#endif
func instancePathBinding(for id: UUID) -> Binding<NavigationPath> { func instancePathBinding(for id: UUID) -> Binding<NavigationPath> {
Binding( Binding(
@@ -984,7 +982,6 @@ extension UnifiedTabView {
// MARK: - Media Source Content // MARK: - Media Source Content
#if os(iOS) || os(macOS)
@ViewBuilder @ViewBuilder
func mediaSourceContent(for item: SidebarItem) -> some View { func mediaSourceContent(for item: SidebarItem) -> some View {
if case .mediaSource(let id, _, _) = item, if case .mediaSource(let id, _, _) = item,
@@ -995,7 +992,6 @@ extension UnifiedTabView {
} }
} }
} }
#endif
// MARK: - Instance Content // MARK: - Instance Content
@@ -1019,11 +1015,7 @@ extension UnifiedTabView {
case .instance: case .instance:
instanceContent(for: item) instanceContent(for: item)
case .mediaSource: case .mediaSource:
#if os(iOS) || os(macOS)
mediaSourceContent(for: item) mediaSourceContent(for: item)
#else
EmptyView()
#endif
default: default:
EmptyView() EmptyView()
} }