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