mirror of
https://github.com/yattee/yattee.git
synced 2025-04-25 08:06:31 +00:00
Fix details reload
This commit is contained in:
parent
8f9fb7ba82
commit
9936d9dd9e
@ -7,6 +7,7 @@ struct VideoDetailsOverlay: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
VideoDetails(video: controls.player.videoForDisplay, fullScreen: fullScreenBinding, sidebarQueue: .constant(false))
|
VideoDetails(video: controls.player.videoForDisplay, fullScreen: fullScreenBinding, sidebarQueue: .constant(false))
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 4))
|
.clipShape(RoundedRectangle(cornerRadius: 4))
|
||||||
|
.id(controls.player.currentVideo?.cacheKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
var fullScreenBinding: Binding<Bool> {
|
var fullScreenBinding: Binding<Bool> {
|
||||||
|
@ -264,72 +264,65 @@ struct VideoDetails: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var pageView: some View {
|
var pageView: some View {
|
||||||
ScrollViewReader { proxy in
|
ScrollView(.vertical, showsIndicators: false) {
|
||||||
ScrollView(.vertical, showsIndicators: false) {
|
LazyVStack {
|
||||||
LazyVStack {
|
pageMenu
|
||||||
pageMenu
|
.padding(5)
|
||||||
.id("top")
|
|
||||||
.padding(5)
|
|
||||||
|
|
||||||
switch page {
|
switch page {
|
||||||
case .info:
|
case .info:
|
||||||
Group {
|
Group {
|
||||||
if let video {
|
if let video {
|
||||||
VStack(alignment: .leading, spacing: 10) {
|
VStack(alignment: .leading, spacing: 10) {
|
||||||
if !player.videoBeingOpened.isNil && (video.description.isNil || video.description!.isEmpty) {
|
if !player.videoBeingOpened.isNil && (video.description.isNil || video.description!.isEmpty) {
|
||||||
VStack {
|
VStack {
|
||||||
ProgressView()
|
ProgressView()
|
||||||
.progressViewStyle(.circular)
|
.progressViewStyle(.circular)
|
||||||
}
|
|
||||||
.frame(maxWidth: .infinity)
|
|
||||||
} else if let description = video.description, !description.isEmpty {
|
|
||||||
VideoDescription(video: video, detailsSize: detailsSize)
|
|
||||||
} else if !video.isLocal {
|
|
||||||
Text("No description")
|
|
||||||
.font(.caption)
|
|
||||||
.foregroundColor(.secondary)
|
|
||||||
}
|
|
||||||
|
|
||||||
if video.isLocal || showInspector == .always {
|
|
||||||
InspectorView(video: player.videoForDisplay)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !sidebarQueue,
|
|
||||||
!(player.videoForDisplay?.related.isEmpty ?? true)
|
|
||||||
{
|
|
||||||
RelatedView()
|
|
||||||
.padding(.top, 20)
|
|
||||||
}
|
}
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
} else if let description = video.description, !description.isEmpty {
|
||||||
|
VideoDescription(video: video, detailsSize: detailsSize)
|
||||||
|
} else if !video.isLocal {
|
||||||
|
Text("No description")
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
}
|
||||||
|
|
||||||
|
if video.isLocal || showInspector == .always {
|
||||||
|
InspectorView(video: player.videoForDisplay)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !sidebarQueue,
|
||||||
|
!(player.videoForDisplay?.related.isEmpty ?? true)
|
||||||
|
{
|
||||||
|
RelatedView()
|
||||||
|
.padding(.top, 20)
|
||||||
}
|
}
|
||||||
.padding(.bottom, 60)
|
|
||||||
}
|
}
|
||||||
|
.padding(.bottom, 60)
|
||||||
}
|
}
|
||||||
.onChange(of: player.currentVideo?.cacheKey) { _ in
|
}
|
||||||
proxy.scrollTo("top")
|
.onAppear {
|
||||||
|
if video != nil, !pageAvailable(page) {
|
||||||
page = .info
|
page = .info
|
||||||
}
|
}
|
||||||
.onAppear {
|
|
||||||
if video != nil, !pageAvailable(page) {
|
|
||||||
page = .info
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.transition(.opacity)
|
|
||||||
.animation(nil, value: player.currentItem)
|
|
||||||
.padding(.horizontal)
|
|
||||||
#if os(iOS)
|
|
||||||
.frame(maxWidth: YatteeApp.isForPreviews ? .infinity : maxWidth)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case .queue:
|
|
||||||
PlayerQueueView(sidebarQueue: false)
|
|
||||||
.padding(.horizontal)
|
|
||||||
|
|
||||||
case .comments:
|
|
||||||
CommentsView(embedInScrollView: false)
|
|
||||||
.onAppear {
|
|
||||||
comments.loadIfNeeded()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
.transition(.opacity)
|
||||||
|
.animation(nil, value: player.currentItem)
|
||||||
|
.padding(.horizontal)
|
||||||
|
#if os(iOS)
|
||||||
|
.frame(maxWidth: YatteeApp.isForPreviews ? .infinity : maxWidth)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
case .queue:
|
||||||
|
PlayerQueueView(sidebarQueue: false)
|
||||||
|
.padding(.horizontal)
|
||||||
|
|
||||||
|
case .comments:
|
||||||
|
CommentsView(embedInScrollView: false)
|
||||||
|
.onAppear {
|
||||||
|
comments.loadIfNeeded()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -343,6 +343,7 @@ struct VideoPlayerView: View {
|
|||||||
player.setNeedsDrawing(true)
|
player.setNeedsDrawing(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.id(player.currentVideo?.cacheKey)
|
||||||
.transition(.opacity)
|
.transition(.opacity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user