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
This commit is contained in:
LisoUseInAIKyrios
2025-08-16 16:17:43 -04:00
parent b86da73a87
commit 25470baeee
2 changed files with 1 additions and 30 deletions

View File

@@ -16,7 +16,6 @@ import java.util.Objects;
import app.revanced.extension.shared.Logger; import app.revanced.extension.shared.Logger;
import app.revanced.extension.shared.Utils; 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.shared.PlayerType;
import app.revanced.extension.youtube.sponsorblock.objects.SponsorSegment; import app.revanced.extension.youtube.sponsorblock.objects.SponsorSegment;
import kotlin.Unit; import kotlin.Unit;
@@ -227,22 +226,4 @@ public class SponsorBlockViewController {
params.bottomMargin = fullScreen ? ctaBottomMargin : defaultBottomMargin; params.bottomMargin = fullScreen ? ctaBottomMargin : defaultBottomMargin;
view.setLayoutParams(params); 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);
}
}
} }

View File

@@ -202,7 +202,7 @@ val sponsorBlockPatch = bytecodePatch(
""" """
invoke-static { v$register }, $EXTENSION_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->appendTimeWithoutSegments(Ljava/lang/String;)Ljava/lang/String; invoke-static { v$register }, $EXTENSION_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->appendTimeWithoutSegments(Ljava/lang/String;)Ljava/lang/String;
move-result-object v$register move-result-object v$register
""", """
) )
} }
@@ -252,15 +252,5 @@ val sponsorBlockPatch = bytecodePatch(
} }
} ?: throw PatchException("Could not find the method which contains the replaceMeWith* strings") } ?: 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.
} }
} }