Remove progress view from video banner

This commit is contained in:
Arkadiusz Fal 2022-12-15 22:40:30 +01:00
parent 404e2e6768
commit a7b489d081

View File

@ -38,11 +38,7 @@ struct VideoBanner: View {
HStack(alignment: .top, spacing: 12) {
VStack(alignment: .trailing, spacing: 2) {
smallThumbnail
#if !os(tvOS)
progressView
#endif
if !timeOnThumbnail, let timeLabel {
Text(timeLabel)
.font(.caption.monospacedDigit())
@ -270,45 +266,6 @@ struct VideoBanner: View {
}
}
private var progressView: some View {
ProgressView(value: watchValue, total: progressViewTotal)
.progressViewStyle(.linear)
.frame(maxWidth: thumbnailWidth)
.opacity(showProgressView ? 1 : 0)
.frame(height: 12)
}
private var showProgressView: Bool {
guard playbackTime != nil,
let video,
!video.live
else {
return false
}
return true
}
private var watchValue: Double {
if finished { return progressViewTotal }
return progressViewValue
}
private var progressViewValue: Double {
guard videoDuration != 0 else { return 1 }
return [playbackTime?.seconds, videoDuration].compactMap { $0 }.min() ?? 0
}
private var progressViewTotal: Double {
guard videoDuration != 0 else { return 1 }
return videoDuration ?? video?.length ?? 1
}
private var finished: Bool {
(progressViewValue / progressViewTotal) * 100 > Double(Defaults[.watchedThreshold])
}
@ViewBuilder private var channelLabel: some View {
if let video, !video.displayAuthor.isEmpty {
Text(video.displayAuthor)