From ed5fa8e4aa5b1e7bc348d49d0b6a910753e2ba3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20F=C3=B6rster?= Date: Sat, 25 Nov 2023 21:48:22 +0100 Subject: [PATCH] no preview shows nothing now --- .../Video Details/VideoDescription.swift | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/Shared/Player/Video Details/VideoDescription.swift b/Shared/Player/Video Details/VideoDescription.swift index 5b4bc99f..9c247e44 100644 --- a/Shared/Player/Video Details/VideoDescription.swift +++ b/Shared/Player/Video Details/VideoDescription.swift @@ -23,21 +23,24 @@ struct VideoDescription: View { descriptionView.id(video.videoID) } - var descriptionView: some View { - VStack { - #if os(iOS) - ActiveLabelDescriptionRepresentable( - description: description, - detailsSize: detailsSize, - expand: shouldExpand - ) - #else - textDescription - #endif + @ViewBuilder var descriptionView: some View { + if !expand && collapsedLinesDescription == 0 { + EmptyView() + } else { + VStack { + #if os(iOS) + ActiveLabelDescriptionRepresentable( + description: description, + detailsSize: detailsSize, + expand: expand + ) + #else + textDescription + #endif - keywords + keywords + }.contentShape(Rectangle()) } - .contentShape(Rectangle()) } var shouldExpand: Bool { @@ -176,7 +179,12 @@ struct VideoDescription: View { } func updateNumberOfLines() { - label.numberOfLines = expand ? 0 : collapsedLinesDescription + if expand || collapsedLinesDescription > 0 { + label.numberOfLines = expand ? 0 : collapsedLinesDescription + label.isHidden = false + } else { + label.isHidden = true + } } func urlTapHandler(_ url: URL) {