From dc3492fd96ab5800b7fc4e3c202a1db9ba8a98b8 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sat, 24 Aug 2024 14:21:52 +0200 Subject: [PATCH] Fix tvOS comments --- Shared/Player/Video Details/CommentView.swift | 9 +++++++-- tvOS/NowPlayingView.swift | 9 ++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Shared/Player/Video Details/CommentView.swift b/Shared/Player/Video Details/CommentView.swift index a59f67a1..c017e432 100644 --- a/Shared/Player/Video Details/CommentView.swift +++ b/Shared/Player/Video Details/CommentView.swift @@ -131,7 +131,9 @@ struct CommentView: View { Text(comment.time) .font(.caption2) + #if !os(tvOS) .foregroundColor(.secondary) + #endif } .lineLimit(1) } @@ -159,11 +161,11 @@ struct CommentView: View { Text("\(comment.likeCount.formattedAsAbbreviation())") } #if !os(tvOS) + .foregroundColor(.secondary) .font(.system(size: 12)) #endif } } - .foregroundColor(.secondary) } private var repliesButton: some View { @@ -181,7 +183,8 @@ struct CommentView: View { Text("Replies") } #if os(tvOS) - .padding(10) + .font(.system(size: 26)) + .padding(.vertical, 3) #endif } .buttonStyle(.plain) @@ -237,6 +240,8 @@ struct CommentView: View { .lineSpacing(3) .fixedSize(horizontal: false, vertical: true) .textSelection(.enabled) + #else + Text(comment.text) #endif } else { Text(rawText) diff --git a/tvOS/NowPlayingView.swift b/tvOS/NowPlayingView.swift index 14f3976a..b6cf3bc0 100644 --- a/tvOS/NowPlayingView.swift +++ b/tvOS/NowPlayingView.swift @@ -11,6 +11,7 @@ struct NowPlayingView: View { var inInfoViewController = false @State private var repliesID: Comment.ID? + @State private var availableWidth = 0.0 @FetchRequest(sortDescriptors: [.init(key: "watchedAt", ascending: false)]) var watches: FetchedResults @@ -109,7 +110,7 @@ struct NowPlayingView: View { } else { Section { ForEach(comments.all) { comment in - CommentView(comment: comment, repliesID: $repliesID) + CommentView(comment: comment, repliesID: $repliesID, availableWidth: availableWidth) } if comments.nextPageAvailable { Text("Scroll to load more...") @@ -120,6 +121,12 @@ struct NowPlayingView: View { } } } + .background(GeometryReader { geometry in + Color.clear + .onAppear { + self.availableWidth = Double(geometry.size.width) + } + }) } }