2021-09-25 08:18:22 +00:00
|
|
|
import Defaults
|
2021-09-18 20:36:42 +00:00
|
|
|
import Siesta
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct WatchNowView: View {
|
2021-10-16 22:48:58 +00:00
|
|
|
@EnvironmentObject<AccountsModel> private var accounts
|
|
|
|
|
2021-09-18 20:36:42 +00:00
|
|
|
var body: some View {
|
2021-10-05 20:20:09 +00:00
|
|
|
PlayerControlsView {
|
|
|
|
ScrollView(.vertical, showsIndicators: false) {
|
2021-10-19 21:27:04 +00:00
|
|
|
if !accounts.current.isNil {
|
2021-10-05 20:20:09 +00:00
|
|
|
VStack(alignment: .leading, spacing: 0) {
|
2021-10-20 22:21:50 +00:00
|
|
|
if accounts.api.signedIn {
|
|
|
|
WatchNowSection(resource: accounts.api.feed, label: "Subscriptions")
|
|
|
|
}
|
|
|
|
if accounts.app.supportsPopular {
|
|
|
|
WatchNowSection(resource: accounts.api.popular, label: "Popular")
|
|
|
|
}
|
|
|
|
WatchNowSection(resource: accounts.api.trending(country: .pl, category: .default), label: "Trending")
|
|
|
|
if accounts.app.supportsTrendingCategories {
|
|
|
|
WatchNowSection(resource: accounts.api.trending(country: .pl, category: .movies), label: "Movies")
|
|
|
|
WatchNowSection(resource: accounts.api.trending(country: .pl, category: .music), label: "Music")
|
2021-10-05 20:20:09 +00:00
|
|
|
}
|
2021-09-18 20:36:42 +00:00
|
|
|
|
2021-09-25 08:18:22 +00:00
|
|
|
// TODO: adding sections to view
|
|
|
|
// ===================
|
|
|
|
// WatchNowPlaylistSection(id: "IVPLmRFYLGYZpq61SpujNw3EKbzzGNvoDmH")
|
2021-09-29 14:29:17 +00:00
|
|
|
// WatchNowSection(resource: api.channelVideos("UCBJycsmduvYEL83R_U4JriQ"), label: "MKBHD")
|
2021-10-05 20:20:09 +00:00
|
|
|
}
|
2021-09-25 08:18:22 +00:00
|
|
|
}
|
2021-09-18 20:36:42 +00:00
|
|
|
}
|
2021-10-17 21:49:56 +00:00
|
|
|
.id(UUID())
|
2021-10-05 20:20:09 +00:00
|
|
|
#if os(tvOS)
|
|
|
|
.edgesIgnoringSafeArea(.horizontal)
|
|
|
|
#else
|
|
|
|
.navigationTitle("Watch Now")
|
|
|
|
#endif
|
|
|
|
#if os(macOS)
|
|
|
|
.background()
|
|
|
|
.frame(minWidth: 360)
|
|
|
|
#endif
|
2021-09-18 20:36:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct WatchNowView_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
WatchNowView()
|
2021-09-29 11:45:00 +00:00
|
|
|
.injectFixtureEnvironmentObjects()
|
2021-09-18 20:36:42 +00:00
|
|
|
}
|
|
|
|
}
|