From a6cfccf5ed05f14cacde74abc465e461ea18c354 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Thu, 16 Apr 2026 06:53:55 +0200 Subject: [PATCH] Make Continue Watching view focusable on tvOS Replace the toolbar-based controls with an inline header row on tvOS so the View Options and clear buttons are reachable with the remote. Drop the navigation title, add an inline title, and disable ScrollView clipping so the focus scale effect isn't clipped. --- Yattee/Views/Home/ContinueWatchingView.swift | 58 +++++++++++++++++++- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/Yattee/Views/Home/ContinueWatchingView.swift b/Yattee/Views/Home/ContinueWatchingView.swift index bec88b8d..20871654 100644 --- a/Yattee/Views/Home/ContinueWatchingView.swift +++ b/Yattee/Views/Home/ContinueWatchingView.swift @@ -40,6 +40,56 @@ struct ContinueWatchingView: View { var body: some View { GeometryReader { geometry in + #if os(tvOS) + VStack(spacing: 0) { + if !inProgressEntries.isEmpty { + HStack(spacing: 24) { + Text(String(localized: "home.continueWatching.title")) + .font(.title2) + .fontWeight(.semibold) + + Spacer() + + Button { + showViewOptions = true + } label: { + Label(String(localized: "viewOptions.title"), systemImage: "slider.horizontal.3") + } + + Menu { + Button(role: .destructive) { + clearAllProgress() + } label: { + Label(String(localized: "continueWatching.clearAll"), systemImage: "trash") + } + } label: { + Image(systemName: "trash") + } + } + .focusSection() + .padding(.horizontal, 48) + .padding(.top, 40) + .padding(.bottom, 40) + } + + Group { + if inProgressEntries.isEmpty { + emptyState + } else { + switch layout { + case .list: + listContent + case .grid: + gridContent + } + } + } + .focusSection() + } + .onChange(of: geometry.size.width, initial: true) { _, newWidth in + viewWidth = newWidth + } + #else Group { if inProgressEntries.isEmpty { emptyState @@ -55,11 +105,11 @@ struct ContinueWatchingView: View { .onChange(of: geometry.size.width, initial: true) { _, newWidth in viewWidth = newWidth } + #endif } - .navigationTitle(String(localized: "home.continueWatching.title")) #if !os(tvOS) + .navigationTitle(String(localized: "home.continueWatching.title")) .toolbarTitleDisplayMode(.inlineLarge) - #endif .toolbar { if !inProgressEntries.isEmpty { ToolbarItem(placement: .primaryAction) { @@ -83,6 +133,7 @@ struct ContinueWatchingView: View { } } } + #endif .sheet(isPresented: $showViewOptions) { ViewOptionsSheet( layout: $layout, @@ -187,6 +238,9 @@ struct ContinueWatchingView: View { } } } + #if os(tvOS) + .scrollClipDisabled() + #endif } // MARK: - Actions