mirror of
https://github.com/yattee/yattee.git
synced 2025-01-23 13:17:04 +00:00
Fix cells on tvOS
This commit is contained in:
parent
b75d3ffe6e
commit
0a95b805f2
@ -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,14 +39,21 @@ 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)
|
||||||
.buttonStyle(.plain)
|
#if os(tvOS)
|
||||||
.contentShape(RoundedRectangle(cornerRadius: thumbnailRoundingCornerRadius))
|
.buttonStyle(.card)
|
||||||
.contextMenu {
|
#else
|
||||||
VideoContextMenuView(video: video)
|
.buttonStyle(.plain)
|
||||||
.environmentObject(accounts)
|
#endif
|
||||||
}
|
.contentShape(RoundedRectangle(cornerRadius: thumbnailRoundingCornerRadius))
|
||||||
|
.contextMenu {
|
||||||
|
VideoContextMenuView(video: video)
|
||||||
|
.environmentObject(accounts)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var thumbnailRoundingCornerRadius: Double {
|
private var thumbnailRoundingCornerRadius: Double {
|
||||||
@ -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")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user