From 90c88728c444dddbd41b123a4f16beae301d205e Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Fri, 17 Apr 2026 07:25:02 +0200 Subject: [PATCH] Adapt resume action sheet layout for tvOS Use a NavigationStack/List layout with a centered thumbnail, stacked title, and card-styled buttons so the focus ring renders with proper clearance on tvOS. --- .../Views/Components/ResumeActionSheet.swift | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/Yattee/Views/Components/ResumeActionSheet.swift b/Yattee/Views/Components/ResumeActionSheet.swift index ecb5867d..29c66364 100644 --- a/Yattee/Views/Components/ResumeActionSheet.swift +++ b/Yattee/Views/Components/ResumeActionSheet.swift @@ -17,6 +17,74 @@ struct ResumeActionSheet: View { let onStartOver: () -> Void var body: some View { + #if os(tvOS) + tvOSContent + #else + iOSContent + #endif + } + + #if os(tvOS) + private var tvOSContent: some View { + NavigationStack { + List { + Section { + VStack(spacing: 16) { + DeArrowVideoThumbnail( + video: video, + duration: video.formattedDuration + ) + .frame(width: 480, height: 270) + .clipShape(RoundedRectangle(cornerRadius: 12)) + + VStack(alignment: .leading, spacing: 4) { + Text(video.title) + .font(.subheadline) + .fontWeight(.medium) + .lineLimit(3) + + Text(video.author.name) + .font(.caption) + .foregroundStyle(.secondary) + .lineLimit(1) + } + .frame(maxWidth: .infinity, alignment: .leading) + } + .frame(maxWidth: .infinity) + .padding(.vertical, 8) + } + + Section { + Button { + onContinue() + dismiss() + } label: { + Label( + String(localized: "resume.action.continueAt \(formattedResumeTime)"), + systemImage: "play.fill" + ) + .labelStyle(.titleAndIcon) + } + + Button { + onStartOver() + dismiss() + } label: { + Label( + String(localized: "resume.action.startFromBeginning"), + systemImage: "arrow.counterclockwise" + ) + .labelStyle(.titleAndIcon) + } + } + } + .scrollClipDisabled() + .padding(.horizontal, 40) + .padding(.vertical, 24) + } + } + #else + private var iOSContent: some View { VStack(spacing: 0) { // Drag indicator RoundedRectangle(cornerRadius: 2.5) @@ -104,6 +172,7 @@ struct ResumeActionSheet: View { .presentationDragIndicator(.hidden) .presentationCornerRadius(16) } + #endif // MARK: - Formatting