2021-06-09 20:51:23 +00:00
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct ContentView: View {
|
2021-07-11 20:52:49 +00:00
|
|
|
@StateObject private var navigationState = NavigationState()
|
2021-08-23 21:31:51 +00:00
|
|
|
@StateObject private var playbackState = PlaybackState()
|
2021-09-19 11:06:54 +00:00
|
|
|
@StateObject private var playlists = Playlists()
|
|
|
|
@StateObject private var recents = Recents()
|
2021-07-29 22:34:13 +00:00
|
|
|
@StateObject private var searchState = SearchState()
|
2021-08-25 22:12:59 +00:00
|
|
|
@StateObject private var subscriptions = Subscriptions()
|
2021-07-07 22:39:18 +00:00
|
|
|
|
2021-07-11 20:52:49 +00:00
|
|
|
#if os(iOS)
|
|
|
|
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
|
|
|
|
#endif
|
2021-06-11 21:11:59 +00:00
|
|
|
|
2021-06-09 20:51:23 +00:00
|
|
|
var body: some View {
|
2021-07-11 20:52:49 +00:00
|
|
|
Section {
|
|
|
|
#if os(iOS)
|
|
|
|
if horizontalSizeClass == .compact {
|
|
|
|
AppTabNavigation()
|
|
|
|
} else {
|
|
|
|
AppSidebarNavigation()
|
2021-06-11 21:11:59 +00:00
|
|
|
}
|
2021-07-11 20:52:49 +00:00
|
|
|
#elseif os(macOS)
|
|
|
|
AppSidebarNavigation()
|
|
|
|
#elseif os(tvOS)
|
|
|
|
TVNavigationView()
|
|
|
|
#endif
|
2021-07-29 22:34:13 +00:00
|
|
|
}
|
2021-08-01 23:01:24 +00:00
|
|
|
#if !os(tvOS)
|
|
|
|
.sheet(isPresented: $navigationState.showingVideo) {
|
|
|
|
if let video = navigationState.video {
|
|
|
|
VideoPlayerView(video)
|
2021-08-22 19:13:33 +00:00
|
|
|
|
2021-08-01 23:01:24 +00:00
|
|
|
#if !os(iOS)
|
2021-08-22 19:13:33 +00:00
|
|
|
.frame(minWidth: 550, minHeight: 720)
|
2021-08-01 23:01:24 +00:00
|
|
|
.onExitCommand {
|
|
|
|
navigationState.showingVideo = false
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
2021-08-29 21:36:18 +00:00
|
|
|
.sheet(isPresented: $navigationState.presentingPlaylistForm) {
|
|
|
|
PlaylistFormView(playlist: $navigationState.editedPlaylist)
|
|
|
|
}
|
2021-08-01 23:01:24 +00:00
|
|
|
#endif
|
2021-07-29 22:34:13 +00:00
|
|
|
.environmentObject(navigationState)
|
2021-08-23 21:31:51 +00:00
|
|
|
.environmentObject(playbackState)
|
2021-09-19 11:06:54 +00:00
|
|
|
.environmentObject(playlists)
|
|
|
|
.environmentObject(recents)
|
2021-08-01 23:01:24 +00:00
|
|
|
.environmentObject(searchState)
|
2021-08-25 22:12:59 +00:00
|
|
|
.environmentObject(subscriptions)
|
2021-07-07 22:39:18 +00:00
|
|
|
}
|
2021-06-09 20:51:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct ContentView_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
ContentView()
|
|
|
|
}
|
|
|
|
}
|