mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 05:23:41 +00:00
Merge pull request #760 from stonerl/hide-video-actions
Hide VideoActions Bar when no buttons is visible
This commit is contained in:
commit
598f17479f
@ -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:
|
||||
|
@ -235,15 +235,22 @@ struct VideoDetails: View {
|
||||
)
|
||||
#endif
|
||||
// swiftlint:enable trailing_closure
|
||||
|
||||
VideoActions(video: player.videoForDisplay)
|
||||
.padding(.vertical, 5)
|
||||
.frame(maxHeight: 50)
|
||||
.frame(maxWidth: .infinity)
|
||||
.borderTop(height: 0.5, color: Color("ControlsBorderColor"))
|
||||
.borderBottom(height: 0.5, color: Color("ControlsBorderColor"))
|
||||
.animation(nil, value: player.currentItem)
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
if VideoActions().isAnyActionVisible() {
|
||||
VideoActions(video: player.videoForDisplay)
|
||||
.padding(.vertical, 5)
|
||||
.frame(maxHeight: 50)
|
||||
.frame(maxWidth: .infinity)
|
||||
.borderTop(height: 0.5, color: Color("ControlsBorderColor"))
|
||||
.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
|
||||
|
Loading…
Reference in New Issue
Block a user