diff --git a/Shared/Player/Video Details/VideoDescription.swift b/Shared/Player/Video Details/VideoDescription.swift index 9c247e44..7f25cc75 100644 --- a/Shared/Player/Video Details/VideoDescription.swift +++ b/Shared/Player/Video Details/VideoDescription.swift @@ -39,7 +39,20 @@ struct VideoDescription: View { #endif keywords - }.contentShape(Rectangle()) + } + .contentShape(Rectangle()) + .overlay( + Group { + #if canImport(UIKit) + if !expand { + Button(action: { expand.toggle() }) { + Rectangle() + .foregroundColor(.clear) + } + } + #endif + } + ) } } @@ -48,15 +61,13 @@ struct VideoDescription: View { } @ViewBuilder var textDescription: some View { - #if !os(iOS) + #if canImport(AppKit) Group { if #available(macOS 12, *) { DescriptionWithLinks(description: description, detailsSize: detailsSize) .frame(maxWidth: .infinity, alignment: .leading) .lineLimit(shouldExpand ? 500 : collapsedLinesDescription) - #if !os(tvOS) .textSelection(.enabled) - #endif } else { Text(description) .frame(maxWidth: .infinity, alignment: .leading) @@ -70,7 +81,7 @@ struct VideoDescription: View { } // If possibe convert URLs to clickable links - #if os(macOS) + #if canImport(AppKit) @available(macOS 12, *) struct DescriptionWithLinks: View { let description: String @@ -126,7 +137,7 @@ struct VideoDescription: View { } var showScrollIndicators: Bool { - #if os(macOS) + #if canImport(AppKit) false #else true diff --git a/Shared/Settings/PlayerSettings.swift b/Shared/Settings/PlayerSettings.swift index fc1056fe..37c3d701 100644 --- a/Shared/Settings/PlayerSettings.swift +++ b/Shared/Settings/PlayerSettings.swift @@ -10,9 +10,9 @@ struct PlayerSettings: View { @Default(.showKeywords) private var showKeywords #if !os(tvOS) @Default(.showScrollToTopInComments) private var showScrollToTopInComments + @Default(.collapsedLinesDescription) private var collapsedLinesDescription #endif @Default(.expandVideoDescription) private var expandVideoDescription - @Default(.collapsedLinesDescription) private var collapsedLinesDescription @Default(.pauseOnHidingPlayer) private var pauseOnHidingPlayer @Default(.closeVideoOnEOF) private var closeVideoOnEOF #if os(iOS) @@ -196,21 +196,23 @@ struct PlayerSettings: View { Toggle("Open video description expanded", isOn: $expandVideoDescription) } - private var collapsedLineDescriptionStepper: some View { - LazyVStack { - Stepper(value: $collapsedLinesDescription, in: 0 ... 10) { - Text("Description preview") - #if os(macOS) - Spacer() - #endif - if collapsedLinesDescription == 0 { - Text("No preview") - } else { - Text("\(collapsedLinesDescription) lines") + #if !os(tvOS) + private var collapsedLineDescriptionStepper: some View { + LazyVStack { + Stepper(value: $collapsedLinesDescription, in: 0 ... 10) { + Text("Description preview") + #if os(macOS) + Spacer() + #endif + if collapsedLinesDescription == 0 { + Text("No preview") + } else { + Text("\(collapsedLinesDescription) lines") + } } } } - } + #endif private var returnYouTubeDislikeToggle: some View { Toggle("Enable Return YouTube Dislike", isOn: $enableReturnYouTubeDislike)