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 favorites = Key<[FavoriteItem]>("favorites", default: [])
static let playerButtonSingleTapGesture = Key<PlayerTapGestureAction>("playerButtonSingleTapGesture", default: .togglePlayer) 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 playerButtonShowsControlButtonsWhenMinimized = Key<Bool>("playerButtonShowsControlButtonsWhenMinimized", default: false)
static let playerButtonIsExpanded = Key<Bool>("playerButtonIsExpanded", default: false) static let playerButtonIsExpanded = Key<Bool>("playerButtonIsExpanded", default: false)
static let playerBarMaxWidth = Key<String>("playerBarMaxWidth", default: "600") static let playerBarMaxWidth = Key<String>("playerBarMaxWidth", default: "600")

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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