VideoDetails: click on channel name opens channel

Signed-off-by: Toni Förster <toni.foerster@gmail.com>
This commit is contained in:
Toni Förster 2024-08-20 14:13:46 +02:00
parent f3c876acf6
commit 0e8436ab40
No known key found for this signature in database
GPG Key ID: 292F3E5086C83FC7

View File

@ -47,9 +47,12 @@ struct VideoDetails: View {
.frame(width: 40, height: 40) .frame(width: 40, height: 40)
.buttonStyle(.plain) .buttonStyle(.plain)
.padding(.trailing, 5) .padding(.trailing, 5)
// TODO: when setting tvOS minimum to 16, the platform modifier can be removed
#if !os(tvOS)
.simultaneousGesture( .simultaneousGesture(
TapGesture() // Ensures the button tap is recognized TapGesture() // Ensures the button tap is recognized
) )
#endif
VStack(alignment: .leading, spacing: 2) { VStack(alignment: .leading, spacing: 2) {
HStack { HStack {
@ -58,6 +61,14 @@ struct VideoDetails: View {
.font(.subheadline) .font(.subheadline)
.fontWeight(.semibold) .fontWeight(.semibold)
.lineLimit(1) .lineLimit(1)
// TODO: when setting tvOS minimum to 16, the platform modifier can be removed
#if !os(tvOS)
.onTapGesture {
guard let channel = video?.channel else { return }
NavigationModel.shared.openChannel(channel, navigationStyle: .sidebar)
}
.accessibilityAddTraits(.isButton)
#endif
} else if model.videoBeingOpened != nil { } else if model.videoBeingOpened != nil {
Text("Yattee") Text("Yattee")
.font(.subheadline) .font(.subheadline)
@ -211,6 +222,7 @@ struct VideoDetails: View {
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
.contentShape(Rectangle()) .contentShape(Rectangle())
.padding(.horizontal, 16) .padding(.horizontal, 16)
// TODO: when setting tvOS minimum to 16, the platform modifier can be removed
#if !os(tvOS) #if !os(tvOS)
.simultaneousGesture( // Simultaneous gesture to prioritize button tap .simultaneousGesture( // Simultaneous gesture to prioritize button tap
TapGesture(count: 2).onEnded { TapGesture(count: 2).onEnded {