Merge pull request #760 from stonerl/hide-video-actions

Hide VideoActions Bar when no buttons is visible
This commit is contained in:
Arkadiusz Fal 2024-08-28 13:33:43 +02:00 committed by GitHub
commit 598f17479f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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 {
switch action {
case .share:

View File

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