1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-14 06:10:32 +05:30
yattee/Shared/VideosView.swift

50 lines
1.2 KiB
Swift
Raw Normal View History

2021-06-27 04:59:55 +05:30
import Defaults
2021-06-12 03:10:35 +05:30
import SwiftUI
struct VideosView: View {
2021-07-19 04:02:46 +05:30
@EnvironmentObject<NavigationState> private var navigationState
@State private var profile = Profile()
2021-07-08 04:31:54 +05:30
2021-07-19 04:02:46 +05:30
#if os(tvOS)
@Default(.layout) var layout
#endif
2021-06-27 04:59:55 +05:30
@Default(.showingAddToPlaylist) var showingAddToPlaylist
2021-07-12 02:22:49 +05:30
#if os(iOS)
@Environment(\.verticalSizeClass) private var horizontalSizeClass
#endif
2021-07-08 04:09:18 +05:30
var videos: [Video]
2021-07-08 04:31:54 +05:30
2021-06-12 03:10:35 +05:30
var body: some View {
VStack {
2021-07-12 02:22:49 +05:30
#if os(tvOS)
if layout == .cells {
VideosCellsView(videos: videos, columns: self.profile.cellsColumns)
} else {
VideosListView(videos: videos)
}
#else
2021-06-27 05:20:32 +05:30
VideosListView(videos: videos)
2021-07-12 02:22:49 +05:30
#if os(macOS)
2021-07-12 04:53:04 +05:30
.frame(minWidth: 400)
2021-07-12 02:22:49 +05:30
#endif
#endif
}
2021-07-12 02:22:49 +05:30
#if os(tvOS)
2021-07-19 04:02:46 +05:30
.fullScreenCover(isPresented: $navigationState.showingVideo) {
if let video = navigationState.video {
VideoPlayerView(video)
}
}
2021-07-12 02:22:49 +05:30
.fullScreenCover(isPresented: $showingAddToPlaylist) {
AddToPlaylistView()
}
2021-07-19 04:02:46 +05:30
2021-07-12 02:22:49 +05:30
#endif
2021-06-12 03:10:35 +05:30
}
}