mirror of
https://github.com/yattee/yattee.git
synced 2024-12-13 05:40:32 +05:30
Remove legacy tvOS list layout
This commit is contained in:
parent
994f1f9215
commit
17291b47e0
@ -106,9 +106,6 @@
|
|||||||
376CD21626FBE18D001E1AC1 /* Instance+Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 376CD21526FBE18D001E1AC1 /* Instance+Fixtures.swift */; };
|
376CD21626FBE18D001E1AC1 /* Instance+Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 376CD21526FBE18D001E1AC1 /* Instance+Fixtures.swift */; };
|
||||||
376CD21726FBE18D001E1AC1 /* Instance+Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 376CD21526FBE18D001E1AC1 /* Instance+Fixtures.swift */; };
|
376CD21726FBE18D001E1AC1 /* Instance+Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 376CD21526FBE18D001E1AC1 /* Instance+Fixtures.swift */; };
|
||||||
376CD21826FBE18D001E1AC1 /* Instance+Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 376CD21526FBE18D001E1AC1 /* Instance+Fixtures.swift */; };
|
376CD21826FBE18D001E1AC1 /* Instance+Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 376CD21526FBE18D001E1AC1 /* Instance+Fixtures.swift */; };
|
||||||
37754C9D26B7500000DBD602 /* VideosView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37754C9C26B7500000DBD602 /* VideosView.swift */; };
|
|
||||||
37754C9E26B7500000DBD602 /* VideosView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37754C9C26B7500000DBD602 /* VideosView.swift */; };
|
|
||||||
37754C9F26B7500000DBD602 /* VideosView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37754C9C26B7500000DBD602 /* VideosView.swift */; };
|
|
||||||
377A20A92693C9A2002842B8 /* TypedContentAccessors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 377A20A82693C9A2002842B8 /* TypedContentAccessors.swift */; };
|
377A20A92693C9A2002842B8 /* TypedContentAccessors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 377A20A82693C9A2002842B8 /* TypedContentAccessors.swift */; };
|
||||||
377A20AA2693C9A2002842B8 /* TypedContentAccessors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 377A20A82693C9A2002842B8 /* TypedContentAccessors.swift */; };
|
377A20AA2693C9A2002842B8 /* TypedContentAccessors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 377A20A82693C9A2002842B8 /* TypedContentAccessors.swift */; };
|
||||||
377A20AB2693C9A2002842B8 /* TypedContentAccessors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 377A20A82693C9A2002842B8 /* TypedContentAccessors.swift */; };
|
377A20AB2693C9A2002842B8 /* TypedContentAccessors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 377A20A82693C9A2002842B8 /* TypedContentAccessors.swift */; };
|
||||||
@ -154,7 +151,6 @@
|
|||||||
37AAF29026740715007FC770 /* Channel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37AAF28F26740715007FC770 /* Channel.swift */; };
|
37AAF29026740715007FC770 /* Channel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37AAF28F26740715007FC770 /* Channel.swift */; };
|
||||||
37AAF29126740715007FC770 /* Channel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37AAF28F26740715007FC770 /* Channel.swift */; };
|
37AAF29126740715007FC770 /* Channel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37AAF28F26740715007FC770 /* Channel.swift */; };
|
||||||
37AAF29226740715007FC770 /* Channel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37AAF28F26740715007FC770 /* Channel.swift */; };
|
37AAF29226740715007FC770 /* Channel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37AAF28F26740715007FC770 /* Channel.swift */; };
|
||||||
37AAF29A26740A01007FC770 /* VideosListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37AAF29926740A01007FC770 /* VideosListView.swift */; };
|
|
||||||
37AAF2A026741C97007FC770 /* SubscriptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37AAF29F26741C97007FC770 /* SubscriptionsView.swift */; };
|
37AAF2A026741C97007FC770 /* SubscriptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37AAF29F26741C97007FC770 /* SubscriptionsView.swift */; };
|
||||||
37AAF2A126741C97007FC770 /* SubscriptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37AAF29F26741C97007FC770 /* SubscriptionsView.swift */; };
|
37AAF2A126741C97007FC770 /* SubscriptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37AAF29F26741C97007FC770 /* SubscriptionsView.swift */; };
|
||||||
37AAF2A226741C97007FC770 /* SubscriptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37AAF29F26741C97007FC770 /* SubscriptionsView.swift */; };
|
37AAF2A226741C97007FC770 /* SubscriptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37AAF29F26741C97007FC770 /* SubscriptionsView.swift */; };
|
||||||
@ -338,7 +334,6 @@
|
|||||||
376578902685490700D4EA09 /* PlaylistsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaylistsView.swift; sourceTree = "<group>"; };
|
376578902685490700D4EA09 /* PlaylistsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaylistsView.swift; sourceTree = "<group>"; };
|
||||||
376B2E0626F920D600B1D64D /* SignInRequiredView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInRequiredView.swift; sourceTree = "<group>"; };
|
376B2E0626F920D600B1D64D /* SignInRequiredView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInRequiredView.swift; sourceTree = "<group>"; };
|
||||||
376CD21526FBE18D001E1AC1 /* Instance+Fixtures.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Instance+Fixtures.swift"; sourceTree = "<group>"; };
|
376CD21526FBE18D001E1AC1 /* Instance+Fixtures.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Instance+Fixtures.swift"; sourceTree = "<group>"; };
|
||||||
37754C9C26B7500000DBD602 /* VideosView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideosView.swift; sourceTree = "<group>"; };
|
|
||||||
377A20A82693C9A2002842B8 /* TypedContentAccessors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypedContentAccessors.swift; sourceTree = "<group>"; };
|
377A20A82693C9A2002842B8 /* TypedContentAccessors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypedContentAccessors.swift; sourceTree = "<group>"; };
|
||||||
3788AC2626F6840700F6BAA9 /* WatchNowSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchNowSection.swift; sourceTree = "<group>"; };
|
3788AC2626F6840700F6BAA9 /* WatchNowSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchNowSection.swift; sourceTree = "<group>"; };
|
||||||
3788AC2A26F6842D00F6BAA9 /* WatchNowSectionBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchNowSectionBody.swift; sourceTree = "<group>"; };
|
3788AC2A26F6842D00F6BAA9 /* WatchNowSectionBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchNowSectionBody.swift; sourceTree = "<group>"; };
|
||||||
@ -353,7 +348,6 @@
|
|||||||
37AAF27D26737323007FC770 /* PopularView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopularView.swift; sourceTree = "<group>"; };
|
37AAF27D26737323007FC770 /* PopularView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopularView.swift; sourceTree = "<group>"; };
|
||||||
37AAF27F26737550007FC770 /* SearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchView.swift; sourceTree = "<group>"; };
|
37AAF27F26737550007FC770 /* SearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchView.swift; sourceTree = "<group>"; };
|
||||||
37AAF28F26740715007FC770 /* Channel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Channel.swift; sourceTree = "<group>"; };
|
37AAF28F26740715007FC770 /* Channel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Channel.swift; sourceTree = "<group>"; };
|
||||||
37AAF29926740A01007FC770 /* VideosListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideosListView.swift; sourceTree = "<group>"; };
|
|
||||||
37AAF29F26741C97007FC770 /* SubscriptionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionsView.swift; sourceTree = "<group>"; };
|
37AAF29F26741C97007FC770 /* SubscriptionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionsView.swift; sourceTree = "<group>"; };
|
||||||
37B044B626F7AB9000E1419D /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
|
37B044B626F7AB9000E1419D /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
|
||||||
37B17D9F268A1F25006AEE9B /* VideoContextMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoContextMenuView.swift; sourceTree = "<group>"; };
|
37B17D9F268A1F25006AEE9B /* VideoContextMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoContextMenuView.swift; sourceTree = "<group>"; };
|
||||||
@ -532,8 +526,6 @@
|
|||||||
3748186D26A769D60084E870 /* DetailBadge.swift */,
|
3748186D26A769D60084E870 /* DetailBadge.swift */,
|
||||||
37A9965926D6F8CA006E3224 /* VideosCellsHorizontal.swift */,
|
37A9965926D6F8CA006E3224 /* VideosCellsHorizontal.swift */,
|
||||||
37F4AE7126828F0900BD60EA /* VideosCellsVertical.swift */,
|
37F4AE7126828F0900BD60EA /* VideosCellsVertical.swift */,
|
||||||
37AAF29926740A01007FC770 /* VideosListView.swift */,
|
|
||||||
37754C9C26B7500000DBD602 /* VideosView.swift */,
|
|
||||||
37D4B18B26717B3800C925CA /* VideoView.swift */,
|
37D4B18B26717B3800C925CA /* VideoView.swift */,
|
||||||
);
|
);
|
||||||
path = Videos;
|
path = Videos;
|
||||||
@ -1072,7 +1064,6 @@
|
|||||||
37977583268922F600DD52A8 /* InvidiousAPI.swift in Sources */,
|
37977583268922F600DD52A8 /* InvidiousAPI.swift in Sources */,
|
||||||
37BE0BD626A1D4A90092E2DB /* PlayerViewController.swift in Sources */,
|
37BE0BD626A1D4A90092E2DB /* PlayerViewController.swift in Sources */,
|
||||||
37BA793F26DB8F97002A0235 /* ChannelVideosView.swift in Sources */,
|
37BA793F26DB8F97002A0235 /* ChannelVideosView.swift in Sources */,
|
||||||
37754C9D26B7500000DBD602 /* VideosView.swift in Sources */,
|
|
||||||
37C194C726F6A9C8005D3B96 /* RecentsModel.swift in Sources */,
|
37C194C726F6A9C8005D3B96 /* RecentsModel.swift in Sources */,
|
||||||
37484C1926FC837400287258 /* PlaybackSettingsView.swift in Sources */,
|
37484C1926FC837400287258 /* PlaybackSettingsView.swift in Sources */,
|
||||||
3711403F26B206A6005B3555 /* SearchModel.swift in Sources */,
|
3711403F26B206A6005B3555 /* SearchModel.swift in Sources */,
|
||||||
@ -1205,7 +1196,6 @@
|
|||||||
37E64DD226D597EB00C71877 /* SubscriptionsModel.swift in Sources */,
|
37E64DD226D597EB00C71877 /* SubscriptionsModel.swift in Sources */,
|
||||||
37C7A1D6267BFD9D0010EAD6 /* SponsorBlockSegment.swift in Sources */,
|
37C7A1D6267BFD9D0010EAD6 /* SponsorBlockSegment.swift in Sources */,
|
||||||
37B767DC2677C3CA0098BAA8 /* PlayerModel.swift in Sources */,
|
37B767DC2677C3CA0098BAA8 /* PlayerModel.swift in Sources */,
|
||||||
37754C9E26B7500000DBD602 /* VideosView.swift in Sources */,
|
|
||||||
3797758C2689345500DD52A8 /* Store.swift in Sources */,
|
3797758C2689345500DD52A8 /* Store.swift in Sources */,
|
||||||
37141674267A8E10006CA35D /* Country.swift in Sources */,
|
37141674267A8E10006CA35D /* Country.swift in Sources */,
|
||||||
37AAF2A126741C97007FC770 /* SubscriptionsView.swift in Sources */,
|
37AAF2A126741C97007FC770 /* SubscriptionsView.swift in Sources */,
|
||||||
@ -1251,7 +1241,6 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
37754C9F26B7500000DBD602 /* VideosView.swift in Sources */,
|
|
||||||
37AAF28026737550007FC770 /* SearchView.swift in Sources */,
|
37AAF28026737550007FC770 /* SearchView.swift in Sources */,
|
||||||
3788AC2D26F6842D00F6BAA9 /* WatchNowSectionBody.swift in Sources */,
|
3788AC2D26F6842D00F6BAA9 /* WatchNowSectionBody.swift in Sources */,
|
||||||
37EAD871267B9ED100D9E01B /* Segment.swift in Sources */,
|
37EAD871267B9ED100D9E01B /* Segment.swift in Sources */,
|
||||||
@ -1288,7 +1277,6 @@
|
|||||||
37AAF27E26737323007FC770 /* PopularView.swift in Sources */,
|
37AAF27E26737323007FC770 /* PopularView.swift in Sources */,
|
||||||
37A9966026D6F9B9006E3224 /* WatchNowView.swift in Sources */,
|
37A9966026D6F9B9006E3224 /* WatchNowView.swift in Sources */,
|
||||||
37484C1F26FC83A400287258 /* InstancesSettingsView.swift in Sources */,
|
37484C1F26FC83A400287258 /* InstancesSettingsView.swift in Sources */,
|
||||||
37AAF29A26740A01007FC770 /* VideosListView.swift in Sources */,
|
|
||||||
37C7A1D7267BFD9D0010EAD6 /* SponsorBlockSegment.swift in Sources */,
|
37C7A1D7267BFD9D0010EAD6 /* SponsorBlockSegment.swift in Sources */,
|
||||||
376578932685490700D4EA09 /* PlaylistsView.swift in Sources */,
|
376578932685490700D4EA09 /* PlaylistsView.swift in Sources */,
|
||||||
37BA795126DC3E0E002A0235 /* Int+Format.swift in Sources */,
|
37BA795126DC3E0E002A0235 /* Int+Format.swift in Sources */,
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
import Defaults
|
import Defaults
|
||||||
|
|
||||||
extension Defaults.Keys {
|
extension Defaults.Keys {
|
||||||
#if os(tvOS)
|
|
||||||
static let layout = Key<ListingLayout>("listingLayout", default: .cells)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static let instances = Key<[Instance]>("instances", default: [])
|
static let instances = Key<[Instance]>("instances", default: [])
|
||||||
static let accounts = Key<[Instance.Account]>("accounts", default: [])
|
static let accounts = Key<[Instance.Account]>("accounts", default: [])
|
||||||
static let defaultAccountID = Key<String?>("defaultAccountID")
|
static let defaultAccountID = Key<String?>("defaultAccountID")
|
||||||
@ -19,20 +15,3 @@ extension Defaults.Keys {
|
|||||||
static let recentlyOpened = Key<[RecentItem]>("recentlyOpened", default: [])
|
static let recentlyOpened = Key<[RecentItem]>("recentlyOpened", default: [])
|
||||||
static let quality = Key<Stream.ResolutionSetting>("quality", default: .hd720pFirstThenBest)
|
static let quality = Key<Stream.ResolutionSetting>("quality", default: .hd720pFirstThenBest)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ListingLayout: String, CaseIterable, Identifiable, Defaults.Serializable {
|
|
||||||
case list, cells
|
|
||||||
|
|
||||||
var id: String {
|
|
||||||
rawValue
|
|
||||||
}
|
|
||||||
|
|
||||||
var name: String {
|
|
||||||
switch self {
|
|
||||||
case .list:
|
|
||||||
return "List"
|
|
||||||
case .cells:
|
|
||||||
return "Cells"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -36,7 +36,7 @@ struct PlaylistsView: View {
|
|||||||
} else if store.collection.isEmpty {
|
} else if store.collection.isEmpty {
|
||||||
hintText("You have no playlists\n\nTap on \"New Playlist\" to create one")
|
hintText("You have no playlists\n\nTap on \"New Playlist\" to create one")
|
||||||
} else {
|
} else {
|
||||||
VideosView(videos: videos)
|
VideosCellsVertical(videos: videos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ struct TrendingView: View {
|
|||||||
Text("Loading")
|
Text("Loading")
|
||||||
}
|
}
|
||||||
|
|
||||||
VideosView(videos: store.collection)
|
VideosCellsVertical(videos: store.collection)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
|
@ -12,7 +12,6 @@ struct VideoView: View {
|
|||||||
@Environment(\.horizontalCells) private var horizontalCells
|
@Environment(\.horizontalCells) private var horizontalCells
|
||||||
|
|
||||||
var video: Video
|
var video: Video
|
||||||
var layout: ListingLayout
|
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Group {
|
Group {
|
||||||
@ -26,27 +25,23 @@ struct VideoView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.modifier(ButtonStyleModifier(layout: layout))
|
.buttonStyle(.plain)
|
||||||
.contentShape(RoundedRectangle(cornerRadius: 12))
|
.contentShape(RoundedRectangle(cornerRadius: 12))
|
||||||
.contextMenu { VideoContextMenuView(video: video) }
|
.contextMenu { VideoContextMenuView(video: video) }
|
||||||
}
|
}
|
||||||
|
|
||||||
var content: some View {
|
var content: some View {
|
||||||
VStack {
|
VStack {
|
||||||
if layout == .cells {
|
#if os(iOS)
|
||||||
#if os(iOS)
|
if verticalSizeClass == .compact, !horizontalCells {
|
||||||
if verticalSizeClass == .compact, !horizontalCells {
|
horizontalRow
|
||||||
horizontalRow
|
.padding(.vertical, 4)
|
||||||
.padding(.vertical, 4)
|
} else {
|
||||||
} else {
|
|
||||||
verticalRow
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
verticalRow
|
verticalRow
|
||||||
#endif
|
}
|
||||||
} else {
|
#else
|
||||||
horizontalRow
|
verticalRow
|
||||||
}
|
#endif
|
||||||
}
|
}
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
.background()
|
.background()
|
||||||
@ -222,7 +217,7 @@ struct VideoView: View {
|
|||||||
.background(.gray)
|
.background(.gray)
|
||||||
.mask(RoundedRectangle(cornerRadius: 12))
|
.mask(RoundedRectangle(cornerRadius: 12))
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
.frame(minHeight: layout == .cells ? 320 : 200)
|
.frame(minHeight: 320)
|
||||||
#endif
|
#endif
|
||||||
.modifier(AspectRatioModifier())
|
.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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ struct VideosCellsHorizontal: View {
|
|||||||
ScrollView(.horizontal, showsIndicators: false) {
|
ScrollView(.horizontal, showsIndicators: false) {
|
||||||
LazyHStack(spacing: 20) {
|
LazyHStack(spacing: 20) {
|
||||||
ForEach(videos) { video in
|
ForEach(videos) { video in
|
||||||
VideoView(video: video, layout: .cells)
|
VideoView(video: video)
|
||||||
.environment(\.horizontalCells, true)
|
.environment(\.horizontalCells, true)
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
.frame(width: 580)
|
.frame(width: 580)
|
||||||
|
@ -13,7 +13,7 @@ struct VideosCellsVertical: View {
|
|||||||
ScrollView(.vertical, showsIndicators: scrollViewShowsIndicators) {
|
ScrollView(.vertical, showsIndicators: scrollViewShowsIndicators) {
|
||||||
LazyVGrid(columns: items, alignment: .center) {
|
LazyVGrid(columns: items, alignment: .center) {
|
||||||
ForEach(videos) { video in
|
ForEach(videos) { video in
|
||||||
VideoView(video: video, layout: .cells)
|
VideoView(video: video)
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
.padding(.horizontal)
|
.padding(.horizontal)
|
||||||
#endif
|
#endif
|
||||||
@ -35,6 +35,10 @@ struct VideosCellsVertical: View {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
.edgesIgnoringSafeArea(.horizontal)
|
.edgesIgnoringSafeArea(.horizontal)
|
||||||
|
#if os(macOS)
|
||||||
|
.background()
|
||||||
|
.frame(minWidth: 360)
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
var items: [GridItem] {
|
var items: [GridItem] {
|
||||||
@ -68,9 +72,9 @@ struct VideosCellsVertical: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct VideoCellsView_Previews: PreviewProvider {
|
struct VideoCellsVertical_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
VideosView(videos: Video.allFixtures)
|
VideosCellsVertical(videos: Video.allFixtures)
|
||||||
.frame(minWidth: 1000)
|
.frame(minWidth: 1000)
|
||||||
.environmentObject(NavigationModel())
|
.environmentObject(NavigationModel())
|
||||||
}
|
}
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
import Defaults
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct VideosListView: View {
|
|
||||||
var videos: [Video]
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
Section {
|
|
||||||
ScrollViewReader { scrollView in
|
|
||||||
List {
|
|
||||||
ForEach(videos) { video in
|
|
||||||
VideoView(video: video, layout: .list)
|
|
||||||
.listRowInsets(EdgeInsets())
|
|
||||||
}
|
|
||||||
.onChange(of: videos) { videos in
|
|
||||||
#if !os(tvOS)
|
|
||||||
|
|
||||||
guard let video = videos.first else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
scrollView.scrollTo(video.id, anchor: .top)
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.listStyle(.grouped)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct VideosListView_Previews: PreviewProvider {
|
|
||||||
static var previews: some View {
|
|
||||||
VideosListView(videos: Video.allFixtures)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
import Defaults
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct VideosView: View {
|
|
||||||
@EnvironmentObject<NavigationModel> private var navigation
|
|
||||||
|
|
||||||
#if os(tvOS)
|
|
||||||
@Default(.layout) private var layout
|
|
||||||
#endif
|
|
||||||
|
|
||||||
var videos: [Video]
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
VStack {
|
|
||||||
#if os(tvOS)
|
|
||||||
if layout == .cells {
|
|
||||||
VideosCellsVertical(videos: videos)
|
|
||||||
} else {
|
|
||||||
VideosListView(videos: videos)
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
VideosCellsVertical(videos: videos)
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#if os(macOS)
|
|
||||||
.background()
|
|
||||||
.frame(minWidth: 360)
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
@ -39,7 +39,7 @@ struct ChannelVideosView: View {
|
|||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
VideosView(videos: store.item?.videos ?? [])
|
VideosCellsVertical(videos: store.item?.videos ?? [])
|
||||||
|
|
||||||
#if !os(iOS)
|
#if !os(iOS)
|
||||||
.prefersDefaultFocus(in: focusNamespace)
|
.prefersDefaultFocus(in: focusNamespace)
|
||||||
|
@ -9,7 +9,7 @@ struct PlaylistVideosView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VideosView(videos: playlist.videos)
|
VideosCellsVertical(videos: playlist.videos)
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
.navigationTitle("\(playlist.title) Playlist")
|
.navigationTitle("\(playlist.title) Playlist")
|
||||||
#endif
|
#endif
|
||||||
|
@ -11,7 +11,7 @@ struct PopularView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VideosView(videos: store.collection)
|
VideosCellsVertical(videos: store.collection)
|
||||||
.onAppear {
|
.onAppear {
|
||||||
resource.addObserver(store)
|
resource.addObserver(store)
|
||||||
resource.loadIfNeeded()
|
resource.loadIfNeeded()
|
||||||
|
@ -37,7 +37,7 @@ struct SearchView: View {
|
|||||||
}
|
}
|
||||||
.edgesIgnoringSafeArea(.horizontal)
|
.edgesIgnoringSafeArea(.horizontal)
|
||||||
#else
|
#else
|
||||||
VideosView(videos: state.store.collection)
|
VideosCellsVertical(videos: state.store.collection)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if noResults {
|
if noResults {
|
||||||
|
@ -12,7 +12,7 @@ struct SubscriptionsView: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
SignInRequiredView(title: "Subscriptions") {
|
SignInRequiredView(title: "Subscriptions") {
|
||||||
VideosView(videos: store.collection)
|
VideosCellsVertical(videos: store.collection)
|
||||||
.onAppear {
|
.onAppear {
|
||||||
loadResources()
|
loadResources()
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,6 @@ import SwiftUI
|
|||||||
struct OptionsView: View {
|
struct OptionsView: View {
|
||||||
@EnvironmentObject<NavigationModel> private var navigation
|
@EnvironmentObject<NavigationModel> private var navigation
|
||||||
|
|
||||||
@Default(.layout) private var layout
|
|
||||||
|
|
||||||
@Environment(\.dismiss) private var dismiss
|
@Environment(\.dismiss) private var dismiss
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@ -18,7 +16,7 @@ struct OptionsView: View {
|
|||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
CoverSectionView("View Options") {
|
CoverSectionView("View Options") {
|
||||||
CoverSectionRowView("Show videos as") { nextLayoutButton }
|
// CoverSectionRowView("Show videos as") { nextLayoutButton }
|
||||||
}
|
}
|
||||||
|
|
||||||
CoverSectionView(divider: false) {
|
CoverSectionView(divider: false) {
|
||||||
@ -39,19 +37,6 @@ struct OptionsView: View {
|
|||||||
}
|
}
|
||||||
.background(.thinMaterial)
|
.background(.thinMaterial)
|
||||||
}
|
}
|
||||||
|
|
||||||
var nextLayoutButton: some View {
|
|
||||||
Button(layout.name) {
|
|
||||||
self.layout = layout.next()
|
|
||||||
}
|
|
||||||
.contextMenu {
|
|
||||||
ForEach(ListingLayout.allCases) { layout in
|
|
||||||
Button(layout.name) {
|
|
||||||
Defaults[.layout] = layout
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OptionsView_Previews: PreviewProvider {
|
struct OptionsView_Previews: PreviewProvider {
|
||||||
|
Loading…
Reference in New Issue
Block a user