Minor fixes

This commit is contained in:
Arkadiusz Fal 2022-12-20 23:24:39 +01:00
parent 37d8873424
commit c432aa3b9a
8 changed files with 30 additions and 26 deletions

View File

@ -34,7 +34,7 @@ extension Defaults.Keys {
static let favorites = Key<[FavoriteItem]>("favorites", default: [])
static let playerButtonSingleTapGesture = Key<PlayerTapGestureAction>("playerButtonSingleTapGesture", default: .togglePlayer)
static let playerButtonDoubleTapGesture = Key<PlayerTapGestureAction>("playerButtonDoubleTapGesture", default: .togglePlayerVisibility)
static let playerButtonDoubleTapGesture = Key<PlayerTapGestureAction>("playerButtonDoubleTapGesture", default: .nothing)
static let playerButtonShowsControlButtonsWhenMinimized = Key<Bool>("playerButtonShowsControlButtonsWhenMinimized", default: false)
static let playerButtonIsExpanded = Key<Bool>("playerButtonIsExpanded", default: false)
static let playerBarMaxWidth = Key<String>("playerBarMaxWidth", default: "600")

View File

@ -23,7 +23,6 @@ struct ControlsGradientView: View {
}
}
struct ControlsGradientView_Previews: PreviewProvider {
static var previews: some View {
ControlsGradientView()

View File

@ -133,7 +133,7 @@ struct VideoActions: View {
case .close:
actionButton("Close", systemImage: "xmark") {
if openWatchNextOnClose {
if player.presentingPlayer, openWatchNextOnClose {
player.pause()
WatchNextViewModel.shared.closed(player.currentItem)
} else {

View File

@ -479,6 +479,5 @@ struct VideoPlayerView_Previews: PreviewProvider {
Color.red
VideoPlayerView()
}
}
}

View File

@ -52,7 +52,7 @@ struct PlayerControlsSettings: View {
#elseif os(iOS)
.listStyle(.insetGrouped)
#endif
.navigationTitle("Player Controls")
.navigationTitle("Controls")
}
@ViewBuilder var sections: some View {

View File

@ -123,17 +123,14 @@ struct VideoBanner: View {
#endif
}
.fixedSize(horizontal: false, vertical: true)
.contentShape(Rectangle())
#if os(tvOS)
.buttonStyle(.card)
#else
.padding(.trailing, 10)
#elseif os(macOS)
.buttonStyle(.plain)
#endif
#if os(tvOS)
.padding(.trailing, 10)
#endif
.opacity(contentOpacity)
.id(id ?? video?.videoID ?? video?.id)
}
private var extraAttributes: some View {

View File

@ -15,8 +15,6 @@ struct VideoCell: View {
@Environment(\.verticalSizeClass) private var verticalSizeClass
#endif
@ObservedObject private var thumbnails = ThumbnailsModel.shared
@Default(.channelOnThumbnail) private var channelOnThumbnail
@Default(.timeOnThumbnail) private var timeOnThumbnail
@Default(.roundedThumbnails) private var roundedThumbnails
@ -445,7 +443,7 @@ struct VideoCell: View {
private var thumbnailImage: some View {
Group {
ThumbnailView(url: thumbnails.best(video))
VideoCellThumbnail(video: video)
#if os(tvOS)
.frame(minHeight: 320)
@ -503,6 +501,15 @@ struct VideoCell: View {
}
}
struct VideoCellThumbnail: View {
let video: Video
@ObservedObject private var thumbnails = ThumbnailsModel.shared
var body: some View {
ThumbnailView(url: thumbnails.best(video))
}
}
struct VideoCell_Preview: PreviewProvider {
static var previews: some View {
Group {

View File

@ -9,6 +9,7 @@ struct PlayingIndicatorView: View {
@ObservedObject private var player = PlayerModel.shared
var body: some View {
if player.isPlaying && player.currentVideo == video {
HStack(spacing: 2) {
bar(low: 0.4)
.animation(animation.speed(1.5), value: drawingHeight)
@ -22,6 +23,7 @@ struct PlayingIndicatorView: View {
drawingHeight.toggle()
}
}
}
func bar(low: Double = 0.0, high: Double = 1.0) -> some View {
RoundedRectangle(cornerRadius: 3)