From 25470baeeee34832599afeea8c453cb453173088 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Sat, 16 Aug 2025 16:17:43 -0400 Subject: [PATCH] fix(YouTube - SponsorBlock): Do not hide voting or create button when the video ends This logic is no longer needed, since YouTube no longer hides the overlay buttons when the video ends --- .../ui/SponsorBlockViewController.java | 19 ------------------- .../layout/sponsorblock/SponsorBlockPatch.kt | 12 +----------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/extensions/youtube/src/main/java/app/revanced/extension/youtube/sponsorblock/ui/SponsorBlockViewController.java b/extensions/youtube/src/main/java/app/revanced/extension/youtube/sponsorblock/ui/SponsorBlockViewController.java index 4749c6930..dd753934a 100644 --- a/extensions/youtube/src/main/java/app/revanced/extension/youtube/sponsorblock/ui/SponsorBlockViewController.java +++ b/extensions/youtube/src/main/java/app/revanced/extension/youtube/sponsorblock/ui/SponsorBlockViewController.java @@ -16,7 +16,6 @@ import java.util.Objects; import app.revanced.extension.shared.Logger; import app.revanced.extension.shared.Utils; -import app.revanced.extension.youtube.settings.Settings; import app.revanced.extension.youtube.shared.PlayerType; import app.revanced.extension.youtube.sponsorblock.objects.SponsorSegment; import kotlin.Unit; @@ -227,22 +226,4 @@ public class SponsorBlockViewController { params.bottomMargin = fullScreen ? ctaBottomMargin : defaultBottomMargin; view.setLayoutParams(params); } - - /** - * Injection point. - */ - public static void endOfVideoReached() { - try { - Logger.printDebug(() -> "endOfVideoReached"); - // the buttons automatically set themselves to visible when appropriate, - // but if buttons are showing when the end of the video is reached then they need - // to be forcefully hidden - if (!Settings.AUTO_REPEAT.get()) { - CreateSegmentButton.hideControls(); - VotingButton.hideControls(); - } - } catch (Exception ex) { - Logger.printException(() -> "endOfVideoReached failure", ex); - } - } } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockPatch.kt index 92407e8bb..06c271b97 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockPatch.kt @@ -202,7 +202,7 @@ val sponsorBlockPatch = bytecodePatch( """ invoke-static { v$register }, $EXTENSION_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->appendTimeWithoutSegments(Ljava/lang/String;)Ljava/lang/String; move-result-object v$register - """, + """ ) } @@ -252,15 +252,5 @@ val sponsorBlockPatch = bytecodePatch( } } ?: throw PatchException("Could not find the method which contains the replaceMeWith* strings") } - - // The vote and create segment buttons automatically change their visibility when appropriate, - // but if buttons are showing when the end of the video is reached then they will not automatically hide. - // Add a hook to forcefully hide when the end of the video is reached. - autoRepeatFingerprint.match(autoRepeatParentFingerprint.originalClassDef).method.addInstruction( - 0, - "invoke-static {}, $EXTENSION_SPONSORBLOCK_VIEW_CONTROLLER_CLASS_DESCRIPTOR->endOfVideoReached()V", - ) - - // TODO: Channel whitelisting. } }