fix(YouTube - SponsorBlock): Fix skip highlight button showing when set to 'show in seekbar'

This commit is contained in:
LisoUseInAIKyrios 2023-07-27 01:24:13 +04:00
parent 8ef81235d7
commit ea7bc57375

View File

@ -50,7 +50,7 @@ public class SegmentPlaybackController {
private static SponsorSegment[] segments;
/**
* Highlight segment, if one exists.
* Highlight segment, if one exists and the skip behavior is not set to {@link CategoryBehaviour#SHOW_IN_SEEKBAR}.
*/
@Nullable
private static SponsorSegment highlightSegment;
@ -112,10 +112,13 @@ public class SegmentPlaybackController {
segments = videoSegments;
calculateTimeWithoutSegments();
for (SponsorSegment segment : videoSegments) {
if (segment.category == SegmentCategory.HIGHLIGHT) {
highlightSegment = segment;
return;
if (SegmentCategory.HIGHLIGHT.behaviour == CategoryBehaviour.SKIP_AUTOMATICALLY
|| SegmentCategory.HIGHLIGHT.behaviour == CategoryBehaviour.MANUAL_SKIP) {
for (SponsorSegment segment : videoSegments) {
if (segment.category == SegmentCategory.HIGHLIGHT) {
highlightSegment = segment;
return;
}
}
}
highlightSegment = null;