mirror of
https://github.com/yattee/yattee.git
synced 2024-12-23 05:53:41 +00:00
Remove progress view from video banner
This commit is contained in:
parent
404e2e6768
commit
a7b489d081
@ -39,10 +39,6 @@ struct VideoBanner: View {
|
|||||||
VStack(alignment: .trailing, spacing: 2) {
|
VStack(alignment: .trailing, spacing: 2) {
|
||||||
smallThumbnail
|
smallThumbnail
|
||||||
|
|
||||||
#if !os(tvOS)
|
|
||||||
progressView
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if !timeOnThumbnail, let timeLabel {
|
if !timeOnThumbnail, let timeLabel {
|
||||||
Text(timeLabel)
|
Text(timeLabel)
|
||||||
.font(.caption.monospacedDigit())
|
.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 {
|
@ViewBuilder private var channelLabel: some View {
|
||||||
if let video, !video.displayAuthor.isEmpty {
|
if let video, !video.displayAuthor.isEmpty {
|
||||||
Text(video.displayAuthor)
|
Text(video.displayAuthor)
|
||||||
|
Loading…
Reference in New Issue
Block a user