Skip to content

Commit

Permalink
new SeekType chapterSkip
Browse files Browse the repository at this point in the history
When a user taps on a chapter, the pop now also shows the name of the chapter. The chapters are now marked in AppRedColor instead of orange.

This is based on PR yattee#639

That one needs to be merged first before this one can go in.
  • Loading branch information
stonerl committed May 3, 2024
1 parent ae65acd commit 03fbb49
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions Model/SeekType.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation

enum SeekType: Equatable {
case chapterSkip(String)
case segmentSkip(String)
case segmentRestore
case userInteracted
Expand Down
8 changes: 8 additions & 0 deletions Shared/Player/Controls/OSD/Seek.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ struct Seek: View {
.font(.system(size: playerControlsLayout.segmentFontSize))
.foregroundColor(getColor(for: category))
.padding(.bottom, 3)
case let .chapterSkip(chapter):
Divider()
Text(chapter)
.font(.system(size: playerControlsLayout.segmentFontSize))
.truncationMode(.tail)
.multilineTextAlignment(.center)
.foregroundColor(Color("AppRedColor"))
.padding(.bottom, 3)
default:
EmptyView()
}
Expand Down
2 changes: 1 addition & 1 deletion Shared/Player/Controls/TimelineView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ struct TimelineView: View {
var chaptersLayers: some View {
ForEach(chapters) { chapter in
RoundedRectangle(cornerRadius: 4)
.fill(Color.orange)
.fill(Color("AppRedColor"))
.frame(maxWidth: 2, maxHeight: height)
.offset(x: (chapter.start * oneUnitWidth) - 1)
}
Expand Down
4 changes: 2 additions & 2 deletions Shared/Player/Video Details/ChapterView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import SwiftUI

var body: some View {
Button(action: {
player.backend.seek(to: chapter.start, seekType: .userInteracted)
player.backend.seek(to: chapter.start, seekType: .chapterSkip(chapter.title))
}) {
Group {
verticalChapter
Expand Down Expand Up @@ -72,7 +72,7 @@ import SwiftUI

var body: some View {
Button {
player.backend.seek(to: chapter.start, seekType: .userInteracted)
player.backend.seek(to: chapter.start, seekType: .chapterSkip(chapter.title))
} label: {
Group {
horizontalChapter
Expand Down

0 comments on commit 03fbb49

Please sign in to comment.