1
0
mirror of https://github.com/yattee/yattee.git synced 2025-04-27 23:40:35 +05:30

Fix details reload

This commit is contained in:
Arkadiusz Fal 2023-04-22 16:49:45 +02:00
parent 8f9fb7ba82
commit 9936d9dd9e
3 changed files with 53 additions and 58 deletions

View File

@ -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> {

View File

@ -264,11 +264,9 @@ 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
.id("top")
.padding(5) .padding(5)
switch page { switch page {
@ -304,10 +302,6 @@ struct VideoDetails: View {
.padding(.bottom, 60) .padding(.bottom, 60)
} }
} }
.onChange(of: player.currentVideo?.cacheKey) { _ in
proxy.scrollTo("top")
page = .info
}
.onAppear { .onAppear {
if video != nil, !pageAvailable(page) { if video != nil, !pageAvailable(page) {
page = .info page = .info
@ -332,7 +326,6 @@ struct VideoDetails: View {
} }
} }
} }
}
#if os(iOS) #if os(iOS)
.onAppear { .onAppear {
if fullScreen { if fullScreen {

View File

@ -343,6 +343,7 @@ struct VideoPlayerView: View {
player.setNeedsDrawing(true) player.setNeedsDrawing(true)
} }
} }
.id(player.currentVideo?.cacheKey)
.transition(.opacity) .transition(.opacity)
} }
} }