Minor code style fixes, remove unneeded views

This commit is contained in:
Arkadiusz Fal
2021-08-01 23:25:50 +02:00
parent 64ff1afa70
commit 66c8b647bf
8 changed files with 30 additions and 70 deletions

View File

@@ -3,7 +3,13 @@ import SwiftUI
import Introspect
#endif
typealias TabSelection = AppSidebarNavigation.TabSelection
struct AppSidebarNavigation: View {
enum TabSelection: String {
case subscriptions, popular, trending, playlists, channel, search
}
@EnvironmentObject<NavigationState> private var navigationState
@State private var didApplyPrimaryViewWorkAround = false

View File

@@ -68,13 +68,9 @@ extension PlayerViewController: AVPlayerViewControllerDelegate {
func playerViewController(
_: AVPlayerViewController,
willBeginFullScreenPresentationWithAnimationCoordinator coordinator: UIViewControllerTransitionCoordinator
willBeginFullScreenPresentationWithAnimationCoordinator _: UIViewControllerTransitionCoordinator
) {
coordinator.animate(alongsideTransition: nil) { context in
if !context.isCancelled {
self.playingFullScreen = true
}
}
playingFullScreen = true
}
func playerViewController(

View File

@@ -1,6 +0,0 @@
import Defaults
import Foundation
enum TabSelection: String, DefaultsSerializable {
case subscriptions, popular, trending, playlists, channel, search
}

View File

@@ -13,37 +13,25 @@ struct VideoPlayerView: View {
var video: Video
var player: AVPlayer!
init(_ video: Video) {
self.video = video
resource.addObserver(store)
player = AVPlayer()
}
var body: some View {
VStack {
#if os(tvOS)
if store.item == nil {
VideoLoading(video: video)
Player(video: video)
.frame(alignment: .leading)
#if !os(tvOS)
ScrollView(.vertical) {
VStack(alignment: .leading) {
Text(video.title)
Text(video.author)
}
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
}
#endif
VStack {
Player(video: video)
.frame(alignment: .leading)
#if !os(tvOS)
ScrollView(.vertical) {
VStack(alignment: .leading) {
Text(video.title)
Text(video.author)
}
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
}
#endif
}
}
.onAppear {
resource.loadIfNeeded()
@@ -54,9 +42,7 @@ struct VideoPlayerView: View {
navigationState.showingVideoDetails = navigationState.returnToDetails
}
#if os(tvOS)
.background(.thinMaterial)
#elseif os(macOS)
#if os(macOS)
.navigationTitle(video.title)
#elseif os(iOS)
.navigationBarTitle(video.title, displayMode: .inline)