Hide VideoActions Bar when no buttons is visible

Signed-off-by: Toni Förster <toni.foerster@gmail.com>
This commit is contained in:
Toni Förster 2024-08-28 12:32:38 +02:00
parent 59da0e71b6
commit 9510d91d61
No known key found for this signature in database
GPG Key ID: 292F3E5086C83FC7
2 changed files with 20 additions and 9 deletions

View File

@ -86,6 +86,10 @@ struct VideoActions: View {
} }
} }
func isAnyActionVisible() -> Bool {
return Action.allCases.contains { isVisible($0) }
}
func isActionable(_ action: Action) -> Bool { func isActionable(_ action: Action) -> Bool {
switch action { switch action {
case .share: case .share:

View File

@ -235,15 +235,22 @@ struct VideoDetails: View {
) )
#endif #endif
// swiftlint:enable trailing_closure // swiftlint:enable trailing_closure
if VideoActions().isAnyActionVisible() {
VideoActions(video: player.videoForDisplay) VideoActions(video: player.videoForDisplay)
.padding(.vertical, 5) .padding(.vertical, 5)
.frame(maxHeight: 50) .frame(maxHeight: 50)
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
.borderTop(height: 0.5, color: Color("ControlsBorderColor")) .borderTop(height: 0.5, color: Color("ControlsBorderColor"))
.borderBottom(height: 0.5, color: Color("ControlsBorderColor")) .borderBottom(height: 0.5, color: Color("ControlsBorderColor"))
.animation(nil, value: player.currentItem) .animation(nil, value: player.currentItem)
.frame(minWidth: 0, maxWidth: .infinity) .frame(minWidth: 0, maxWidth: .infinity)
} else {
Rectangle()
.fill(Color.clear)
.frame(height: 0.5)
.frame(maxWidth: .infinity)
.background(Color("ControlsBorderColor"))
}
ScrollViewReader { proxy in ScrollViewReader { proxy in
pageView pageView