Fix cells on tvOS

This commit is contained in:
Arkadiusz Fal 2022-08-26 01:38:04 +02:00
parent b75d3ffe6e
commit 0a95b805f2

View File

@ -6,12 +6,12 @@ import SwiftUI
struct VideoCell: View { struct VideoCell: View {
private var video: Video private var video: Video
@Environment(\.navigationStyle) private var navigationStyle @Environment(\.horizontalCells) private var horizontalCells
@Environment(\.inChannelView) private var inChannelView @Environment(\.inChannelView) private var inChannelView
@Environment(\.navigationStyle) private var navigationStyle
#if os(iOS) #if os(iOS)
@Environment(\.verticalSizeClass) private var verticalSizeClass @Environment(\.verticalSizeClass) private var verticalSizeClass
@Environment(\.horizontalCells) private var horizontalCells
#endif #endif
@EnvironmentObject<AccountsModel> private var accounts @EnvironmentObject<AccountsModel> private var accounts
@ -39,9 +39,16 @@ struct VideoCell: View {
var body: some View { var body: some View {
Button(action: playAction) { Button(action: playAction) {
content content
#if os(tvOS)
.frame(width: 580, height: 470)
#endif
} }
.opacity(contentOpacity) .opacity(contentOpacity)
#if os(tvOS)
.buttonStyle(.card)
#else
.buttonStyle(.plain) .buttonStyle(.plain)
#endif
.contentShape(RoundedRectangle(cornerRadius: thumbnailRoundingCornerRadius)) .contentShape(RoundedRectangle(cornerRadius: thumbnailRoundingCornerRadius))
.contextMenu { .contextMenu {
VideoContextMenuView(video: video) VideoContextMenuView(video: video)
@ -290,7 +297,7 @@ struct VideoCell: View {
.padding(.top, 4) .padding(.top, 4)
.frame(minWidth: 0, maxWidth: .infinity, alignment: .topLeading) .frame(minWidth: 0, maxWidth: .infinity, alignment: .topLeading)
#if os(tvOS) #if os(tvOS)
.padding(.horizontal, 8) .padding(.horizontal, horizontalCells ? 10 : 20)
#endif #endif
} }
} }
@ -318,7 +325,11 @@ struct VideoCell: View {
.foregroundColor(.secondary) .foregroundColor(.secondary)
} }
} }
#if os(tvOS)
.buttonStyle(.card)
#else
.buttonStyle(.plain) .buttonStyle(.plain)
#endif
.help("\(video.channel.name) Channel") .help("\(video.channel.name) Channel")
} }