Remove legacy tvOS list layout

This commit is contained in:
Arkadiusz Fal
2021-09-27 00:28:42 +02:00
parent 994f1f9215
commit 17291b47e0
15 changed files with 27 additions and 160 deletions

View File

@@ -12,7 +12,6 @@ struct VideoView: View {
@Environment(\.horizontalCells) private var horizontalCells
var video: Video
var layout: ListingLayout
var body: some View {
Group {
@@ -26,27 +25,23 @@ struct VideoView: View {
}
}
}
.modifier(ButtonStyleModifier(layout: layout))
.buttonStyle(.plain)
.contentShape(RoundedRectangle(cornerRadius: 12))
.contextMenu { VideoContextMenuView(video: video) }
}
var content: some View {
VStack {
if layout == .cells {
#if os(iOS)
if verticalSizeClass == .compact, !horizontalCells {
horizontalRow
.padding(.vertical, 4)
} else {
verticalRow
}
#else
#if os(iOS)
if verticalSizeClass == .compact, !horizontalCells {
horizontalRow
.padding(.vertical, 4)
} else {
verticalRow
#endif
} else {
horizontalRow
}
}
#else
verticalRow
#endif
}
#if os(macOS)
.background()
@@ -222,7 +217,7 @@ struct VideoView: View {
.background(.gray)
.mask(RoundedRectangle(cornerRadius: 12))
#if os(tvOS)
.frame(minHeight: layout == .cells ? 320 : 200)
.frame(minHeight: 320)
#endif
.modifier(AspectRatioModifier())
}
@@ -248,22 +243,4 @@ struct VideoView: View {
}
}
}
struct ButtonStyleModifier: ViewModifier {
var layout: ListingLayout
func body(content: Content) -> some View {
Section {
#if os(tvOS)
if layout == .cells {
content.buttonStyle(.plain)
} else {
content
}
#else
content.buttonStyle(.plain)
#endif
}
}
}
}