mirror of
https://github.com/yattee/yattee.git
synced 2025-01-08 22:07:10 +00:00
iOS click on collapsed description text expands it
This commit is contained in:
parent
6994271eca
commit
d384a4c520
@ -39,7 +39,20 @@ struct VideoDescription: View {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
keywords
|
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 {
|
@ViewBuilder var textDescription: some View {
|
||||||
#if !os(iOS)
|
#if canImport(AppKit)
|
||||||
Group {
|
Group {
|
||||||
if #available(macOS 12, *) {
|
if #available(macOS 12, *) {
|
||||||
DescriptionWithLinks(description: description, detailsSize: detailsSize)
|
DescriptionWithLinks(description: description, detailsSize: detailsSize)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
.lineLimit(shouldExpand ? 500 : collapsedLinesDescription)
|
.lineLimit(shouldExpand ? 500 : collapsedLinesDescription)
|
||||||
#if !os(tvOS)
|
|
||||||
.textSelection(.enabled)
|
.textSelection(.enabled)
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
Text(description)
|
Text(description)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
@ -70,7 +81,7 @@ struct VideoDescription: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If possibe convert URLs to clickable links
|
// If possibe convert URLs to clickable links
|
||||||
#if os(macOS)
|
#if canImport(AppKit)
|
||||||
@available(macOS 12, *)
|
@available(macOS 12, *)
|
||||||
struct DescriptionWithLinks: View {
|
struct DescriptionWithLinks: View {
|
||||||
let description: String
|
let description: String
|
||||||
@ -126,7 +137,7 @@ struct VideoDescription: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var showScrollIndicators: Bool {
|
var showScrollIndicators: Bool {
|
||||||
#if os(macOS)
|
#if canImport(AppKit)
|
||||||
false
|
false
|
||||||
#else
|
#else
|
||||||
true
|
true
|
||||||
|
@ -10,9 +10,9 @@ struct PlayerSettings: View {
|
|||||||
@Default(.showKeywords) private var showKeywords
|
@Default(.showKeywords) private var showKeywords
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
@Default(.showScrollToTopInComments) private var showScrollToTopInComments
|
@Default(.showScrollToTopInComments) private var showScrollToTopInComments
|
||||||
|
@Default(.collapsedLinesDescription) private var collapsedLinesDescription
|
||||||
#endif
|
#endif
|
||||||
@Default(.expandVideoDescription) private var expandVideoDescription
|
@Default(.expandVideoDescription) private var expandVideoDescription
|
||||||
@Default(.collapsedLinesDescription) private var collapsedLinesDescription
|
|
||||||
@Default(.pauseOnHidingPlayer) private var pauseOnHidingPlayer
|
@Default(.pauseOnHidingPlayer) private var pauseOnHidingPlayer
|
||||||
@Default(.closeVideoOnEOF) private var closeVideoOnEOF
|
@Default(.closeVideoOnEOF) private var closeVideoOnEOF
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
@ -196,21 +196,23 @@ struct PlayerSettings: View {
|
|||||||
Toggle("Open video description expanded", isOn: $expandVideoDescription)
|
Toggle("Open video description expanded", isOn: $expandVideoDescription)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var collapsedLineDescriptionStepper: some View {
|
#if !os(tvOS)
|
||||||
LazyVStack {
|
private var collapsedLineDescriptionStepper: some View {
|
||||||
Stepper(value: $collapsedLinesDescription, in: 0 ... 10) {
|
LazyVStack {
|
||||||
Text("Description preview")
|
Stepper(value: $collapsedLinesDescription, in: 0 ... 10) {
|
||||||
#if os(macOS)
|
Text("Description preview")
|
||||||
Spacer()
|
#if os(macOS)
|
||||||
#endif
|
Spacer()
|
||||||
if collapsedLinesDescription == 0 {
|
#endif
|
||||||
Text("No preview")
|
if collapsedLinesDescription == 0 {
|
||||||
} else {
|
Text("No preview")
|
||||||
Text("\(collapsedLinesDescription) lines")
|
} else {
|
||||||
|
Text("\(collapsedLinesDescription) lines")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
|
|
||||||
private var returnYouTubeDislikeToggle: some View {
|
private var returnYouTubeDislikeToggle: some View {
|
||||||
Toggle("Enable Return YouTube Dislike", isOn: $enableReturnYouTubeDislike)
|
Toggle("Enable Return YouTube Dislike", isOn: $enableReturnYouTubeDislike)
|
||||||
|
Loading…
Reference in New Issue
Block a user