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