feat(YouTube/Player components): add setting toggle for Hide suggested video end screen https://github.com/inotia00/ReVanced_Extended/issues/2066

This commit is contained in:
inotia00
2024-05-27 20:43:42 +09:00
parent 2ce77b15da
commit b5038586a0
4 changed files with 12 additions and 10 deletions

View File

@ -4,7 +4,6 @@ import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.patches.youtube.utils.fix.fullscreen.FullscreenButtonViewStubPatch
import app.revanced.patches.youtube.utils.fix.suggestedvideoendscreen.SuggestedVideoEndScreenPatch
import app.revanced.patches.youtube.utils.integrations.Constants.OVERLAY_BUTTONS_PATH
import app.revanced.patches.youtube.utils.playercontrols.PlayerControlsPatch
import app.revanced.patches.youtube.utils.settings.SettingsPatch
@ -30,7 +29,6 @@ object OverlayButtonsPatch : BaseResourcePatch(
FullscreenButtonViewStubPatch::class,
PlayerControlsPatch::class,
SettingsPatch::class,
SuggestedVideoEndScreenPatch::class,
OverlayButtonsBytecodePatch::class,
VideoInformationPatch::class
),

View File

@ -7,6 +7,7 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.youtube.utils.fix.suggestedvideoendscreen.fingerprints.RemoveOnLayoutChangeListenerFingerprint
import app.revanced.patches.youtube.utils.integrations.Constants.PLAYER_CLASS_DESCRIPTOR
import app.revanced.util.getTargetIndex
import app.revanced.util.getTargetIndexReversed
import app.revanced.util.getWalkerMethod
@ -43,6 +44,10 @@ object SuggestedVideoEndScreenPatch : BytecodePatch(
addInstructionsWithLabels(
0,
"""
invoke-static {}, $PLAYER_CLASS_DESCRIPTOR->hideSuggestedVideoEndScreen()Z
move-result v0
if-eqz v0, :show_suggested_video_end_screen
iget-object v0, p0, $iGetObjectReference
# This reference checks whether autoplay is turned on.