Merge pull request #742 from stonerl/subscription-button

Improvements to opening channels from Videos
This commit is contained in:
Arkadiusz Fal 2024-08-24 12:09:07 +02:00 committed by GitHub
commit 516e305cd3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 4 deletions

View File

@ -380,7 +380,7 @@ struct ChannelVideosView: View {
navigation.sidebarSectionChanged.toggle()
}
} label: {
Label("Subscribe", systemImage: "circle")
Label("Subscribe", systemImage: "star.circle")
.help("Subscribe")
#if os(iOS)
.labelStyle(.automatic)

View File

@ -47,6 +47,12 @@ struct VideoDetails: View {
.frame(width: 40, height: 40)
.buttonStyle(.plain)
.padding(.trailing, 5)
// TODO: when setting tvOS minimum to 16, the platform modifier can be removed
#if !os(tvOS)
.simultaneousGesture(
TapGesture() // Ensures the button tap is recognized
)
#endif
VStack(alignment: .leading, spacing: 2) {
HStack {
@ -55,6 +61,14 @@ struct VideoDetails: View {
.font(.subheadline)
.fontWeight(.semibold)
.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 {
Text("Yattee")
.font(.subheadline)
@ -208,10 +222,10 @@ struct VideoDetails: View {
.frame(maxWidth: .infinity, alignment: .leading)
.contentShape(Rectangle())
.padding(.horizontal, 16)
// TODO: when setting tvOS minimum to 16, the platform modifier can be removed
#if !os(tvOS)
.tapRecognizer(
tapSensitivity: 0.2,
doubleTapAction: {
.simultaneousGesture( // Simultaneous gesture to prioritize button tap
TapGesture(count: 2).onEnded {
withAnimation(.default) {
fullScreen.toggle()
}