From 70b45b2a263b0941f9e4c89e9110f3001a1986dd Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Fri, 27 Sep 2024 19:16:38 +0900 Subject: [PATCH] chore(YouTube): no longer checks `PlayerType` or `VideoInformation` to determine if it's a Short or not --- .../BackgroundPlaybackPatch.kt | 2 -- .../components/ShortsNavigationBarPatch.kt | 20 ++----------------- .../fingerprints/ReelWatchPagerFingerprint.kt | 12 ----------- 3 files changed, 2 insertions(+), 32 deletions(-) delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ReelWatchPagerFingerprint.kt diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/backgroundplayback/BackgroundPlaybackPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/backgroundplayback/BackgroundPlaybackPatch.kt index 825b4496f..827458cb7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/backgroundplayback/BackgroundPlaybackPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/backgroundplayback/BackgroundPlaybackPatch.kt @@ -14,7 +14,6 @@ import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PAC import app.revanced.patches.youtube.utils.integrations.Constants.MISC_PATH import app.revanced.patches.youtube.utils.playertype.PlayerTypeHookPatch import app.revanced.patches.youtube.utils.settings.SettingsPatch -import app.revanced.patches.youtube.video.information.VideoInformationPatch import app.revanced.util.findOpcodeIndicesReversed import app.revanced.util.getWalkerMethod import app.revanced.util.patch.BaseBytecodePatch @@ -31,7 +30,6 @@ object BackgroundPlaybackPatch : BaseBytecodePatch( description = "Removes restrictions on background playback, including for music and kids videos.", dependencies = setOf( PlayerTypeHookPatch::class, - VideoInformationPatch::class, SettingsPatch::class ), compatiblePackages = COMPATIBLE_PACKAGE, diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsNavigationBarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsNavigationBarPatch.kt index 76d52e95d..337a239fb 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsNavigationBarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsNavigationBarPatch.kt @@ -5,17 +5,14 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.youtube.shorts.components.fingerprints.BottomBarContainerHeightFingerprint -import app.revanced.patches.youtube.shorts.components.fingerprints.ReelWatchPagerFingerprint import app.revanced.patches.youtube.utils.integrations.Constants.SHORTS_CLASS_DESCRIPTOR import app.revanced.patches.youtube.utils.navigation.NavigationBarHookPatch +import app.revanced.patches.youtube.utils.playertype.fingerprint.ReelWatchPagerFingerprint import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.BottomBarContainer -import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelWatchPlayer -import app.revanced.util.REGISTER_TEMPLATE_REPLACEMENT import app.revanced.util.fingerprint.MultiMethodFingerprint import app.revanced.util.getReference import app.revanced.util.indexOfFirstInstructionOrThrow import app.revanced.util.indexOfFirstWideLiteralInstructionValue -import app.revanced.util.injectLiteralInstructionViewCall import app.revanced.util.patch.MultiMethodBytecodePatch import app.revanced.util.resultOrThrow import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @@ -55,7 +52,7 @@ object ShortsNavigationBarPatch : MultiMethodBytecodePatch( addInstructions( targetIndex + 1, """ - invoke-static {v$heightRegister}, $SHORTS_CLASS_DESCRIPTOR->overrideNavigationBarHeight(I)I + invoke-static {v$heightRegister}, $SHORTS_CLASS_DESCRIPTOR->setNavigationBarHeight(I)I move-result v$heightRegister """ ) @@ -66,18 +63,5 @@ object ShortsNavigationBarPatch : MultiMethodBytecodePatch( // endregion. - // region patch for addOnAttachStateChangeListener. - - val smaliInstruction = """ - invoke-static {v$REGISTER_TEMPLATE_REPLACEMENT}, $SHORTS_CLASS_DESCRIPTOR->onShortsCreate(Landroid/view/View;)V - """ - - ReelWatchPagerFingerprint.injectLiteralInstructionViewCall( - ReelWatchPlayer, - smaliInstruction - ) - - // endregion. - } } \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ReelWatchPagerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ReelWatchPagerFingerprint.kt deleted file mode 100644 index e4267393c..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ReelWatchPagerFingerprint.kt +++ /dev/null @@ -1,12 +0,0 @@ -package app.revanced.patches.youtube.shorts.components.fingerprints - -import app.revanced.patcher.extensions.or -import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelWatchPlayer -import app.revanced.util.fingerprint.LiteralValueFingerprint -import com.android.tools.smali.dexlib2.AccessFlags - -internal object ReelWatchPagerFingerprint : LiteralValueFingerprint( - accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, - returnType = "Landroid/view/View;", - literalSupplier = { ReelWatchPlayer } -) \ No newline at end of file