diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/ShortsComponentPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsComponentPatch.kt similarity index 59% rename from src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/ShortsComponentPatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsComponentPatch.kt index 7794fa979..e355a19c1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/ShortsComponentPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsComponentPatch.kt @@ -1,25 +1,21 @@ -package app.revanced.patches.youtube.shorts.shortscomponent +package app.revanced.patches.youtube.shorts.components import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels import app.revanced.patcher.extensions.InstructionExtensions.getInstruction +import app.revanced.patcher.fingerprint.MethodFingerprint import app.revanced.patcher.patch.BytecodePatch -import app.revanced.patcher.patch.PatchException import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.smali.ExternalLabel -import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsCommentFingerprint -import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsDislikeFingerprint -import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsInfoPanelFingerprint -import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsLikeFingerprint -import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsPaidPromotionFingerprint -import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsPivotFingerprint -import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsPivotLegacyFingerprint -import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsRemixFingerprint -import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsShareFingerprint +import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsButtonFingerprint +import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsInfoPanelFingerprint +import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsPaidPromotionFingerprint +import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsPivotFingerprint +import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsPivotLegacyFingerprint import app.revanced.patches.youtube.utils.integrations.Constants.COMPONENTS_PATH import app.revanced.patches.youtube.utils.integrations.Constants.SHORTS import app.revanced.patches.youtube.utils.litho.LithoFilterPatch @@ -86,15 +82,11 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Suppress("unused") object ShortsComponentPatch : BytecodePatch( setOf( - ShortsCommentFingerprint, - ShortsDislikeFingerprint, + ShortsButtonFingerprint, ShortsInfoPanelFingerprint, - ShortsLikeFingerprint, ShortsPaidPromotionFingerprint, ShortsPivotFingerprint, - ShortsPivotLegacyFingerprint, - ShortsRemixFingerprint, - ShortsShareFingerprint, + ShortsPivotLegacyFingerprint ) ) { override fun execute(context: BytecodeContext) { @@ -102,59 +94,41 @@ object ShortsComponentPatch : BytecodePatch( /** * Comment button */ - ShortsCommentFingerprint.result?.let { - it.mutableMethod.apply { - val insertIndex = getWideLiteralInstructionIndex(RightComment) + 3 - - hideButton(insertIndex, 1, "hideShortsPlayerCommentsButton") - } - } ?: throw ShortsCommentFingerprint.exception + ShortsButtonFingerprint.hideButton(RightComment, "hideShortsPlayerCommentsButton", false) /** * Dislike button */ - ShortsDislikeFingerprint.result?.let { + ShortsButtonFingerprint.result?.let { it.mutableMethod.apply { - val insertIndex = getWideLiteralInstructionIndex(ReelRightDislikeIcon) - val insertRegister = getInstruction(insertIndex).registerA + val constIndex = getWideLiteralInstructionIndex(ReelRightDislikeIcon) + val constRegister = getInstruction(constIndex).registerA - val jumpIndex = getTargetIndex(insertIndex, Opcode.CONST_CLASS) + 2 + val jumpIndex = getTargetIndex(constIndex, Opcode.CONST_CLASS) + 2 addInstructionsWithLabels( - insertIndex + 1, """ + constIndex + 1, """ invoke-static {}, $SHORTS->hideShortsPlayerDislikeButton()Z - move-result v$insertRegister - if-nez v$insertRegister, :hide - const v$insertRegister, $ReelRightDislikeIcon + move-result v$constRegister + if-nez v$constRegister, :hide + const v$constRegister, $ReelRightDislikeIcon """, ExternalLabel("hide", getInstruction(jumpIndex)) ) } - } ?: throw ShortsDislikeFingerprint.exception + } ?: throw ShortsButtonFingerprint.exception /** * Info panel */ - ShortsInfoPanelFingerprint.result?.let { - it.mutableMethod.apply { - val insertIndex = getWideLiteralInstructionIndex(ReelPlayerInfoPanel) + 3 - - hideButtons( - insertIndex, - 1, - "hideShortsPlayerInfoPanel(Landroid/view/ViewGroup;)Landroid/view/ViewGroup;" - ) - } - } ?: throw ShortsInfoPanelFingerprint.exception + ShortsInfoPanelFingerprint.hideButtons(ReelPlayerInfoPanel, "hideShortsPlayerInfoPanel(Landroid/view/ViewGroup;)Landroid/view/ViewGroup;") /** * Like button */ - ShortsLikeFingerprint.result?.let { + ShortsButtonFingerprint.result?.let { it.mutableMethod.apply { val insertIndex = getWideLiteralInstructionIndex(ReelRightLikeIcon) - val insertRegister = getInstruction(insertIndex).registerA - val jumpIndex = getTargetIndex(insertIndex, Opcode.CONST_CLASS) + 2 addInstructionsWithLabels( @@ -166,41 +140,13 @@ object ShortsComponentPatch : BytecodePatch( """, ExternalLabel("hide", getInstruction(jumpIndex)) ) } - } ?: throw ShortsLikeFingerprint.exception + } ?: throw ShortsButtonFingerprint.exception /** * Paid promotion */ - ShortsPaidPromotionFingerprint.result?.let { - it.mutableMethod.apply { - val primaryIndex = getWideLiteralInstructionIndex(ReelPlayerBadge) + 3 - val secondaryIndex = getWideLiteralInstructionIndex(ReelPlayerBadge2) + 3 - - if (primaryIndex > secondaryIndex) { - hideButtons( - primaryIndex, - 1, - "hideShortsPlayerPaidPromotionBanner(Landroid/view/ViewStub;)Landroid/view/ViewStub;" - ) - hideButtons( - secondaryIndex, - 1, - "hideShortsPlayerPaidPromotionBanner(Landroid/view/ViewStub;)Landroid/view/ViewStub;" - ) - } else { - hideButtons( - secondaryIndex, - 1, - "hideShortsPlayerPaidPromotionBanner(Landroid/view/ViewStub;)Landroid/view/ViewStub;" - ) - hideButtons( - primaryIndex, - 1, - "hideShortsPlayerPaidPromotionBanner(Landroid/view/ViewStub;)Landroid/view/ViewStub;" - ) - } - } - } ?: throw ShortsPaidPromotionFingerprint.exception + ShortsPaidPromotionFingerprint.hideButtons(ReelPlayerBadge, "hideShortsPlayerPaidPromotionBanner(Landroid/view/ViewStub;)Landroid/view/ViewStub;") + ShortsPaidPromotionFingerprint.hideButtons(ReelPlayerBadge2, "hideShortsPlayerPaidPromotionBanner(Landroid/view/ViewStub;)Landroid/view/ViewStub;") /** * Pivot button @@ -224,37 +170,21 @@ object ShortsComponentPatch : BytecodePatch( } ?: ShortsPivotFingerprint.result?.let { it.mutableMethod.apply { val targetIndex = getWideLiteralInstructionIndex(ReelPivotButton) - val insertIndex = getTargetIndexReversed(targetIndex, Opcode.INVOKE_STATIC) + 2 + val insertIndex = getTargetIndexReversed(targetIndex, Opcode.INVOKE_STATIC) + 1 - hideButtons( - insertIndex, - 0, - "hideShortsPlayerPivotButton(Ljava/lang/Object;)Ljava/lang/Object;" - ) + hideButtons(insertIndex, "hideShortsPlayerPivotButton(Ljava/lang/Object;)Ljava/lang/Object;") } } ?: throw ShortsPivotFingerprint.exception /** * Remix button */ - ShortsRemixFingerprint.result?.let { - it.mutableMethod.apply { - val insertIndex = getWideLiteralInstructionIndex(ReelDynRemix) - 2 - - hideButton(insertIndex, 0, "hideShortsPlayerRemixButton") - } - } ?: throw ShortsRemixFingerprint.exception + ShortsButtonFingerprint.hideButton(ReelDynRemix, "hideShortsPlayerRemixButton", true) /** * Share button */ - ShortsShareFingerprint.result?.let { - it.mutableMethod.apply { - val insertIndex = getWideLiteralInstructionIndex(ReelDynShare) - 2 - - hideButton(insertIndex, 0, "hideShortsPlayerShareButton") - } - } ?: throw ShortsShareFingerprint.exception + ShortsButtonFingerprint.hideButton(ReelDynShare, "hideShortsPlayerShareButton", true) LithoFilterPatch.addFilter("$COMPONENTS_PATH/ShortsFilter;") @@ -274,28 +204,50 @@ object ShortsComponentPatch : BytecodePatch( } - private fun MutableMethod.hideButton( - insertIndex: Int, - offset: Int, + private fun MethodFingerprint.hideButton( + id: Long, + descriptor: String, + reversed: Boolean + ) { + result?.let { + it.mutableMethod.apply { + val constIndex = getWideLiteralInstructionIndex(id) + val insertIndex = if (reversed) + getTargetIndexReversed(constIndex, Opcode.CHECK_CAST) + else + getTargetIndex(constIndex, Opcode.CHECK_CAST) + val insertRegister = getInstruction(insertIndex).registerA + + addInstruction( + insertIndex, + "invoke-static {v$insertRegister}, $SHORTS->$descriptor(Landroid/view/View;)V" + ) + } + } ?: throw exception + } + + private fun MethodFingerprint.hideButtons( + id: Long, descriptor: String ) { - val insertRegister = getInstruction(insertIndex).registerA + result?.let { + it.mutableMethod.apply { + val constIndex = getWideLiteralInstructionIndex(id) + val insertIndex = getTargetIndex(constIndex, Opcode.CHECK_CAST) - addInstruction( - insertIndex + offset, - "invoke-static {v$insertRegister}, $SHORTS->$descriptor(Landroid/view/View;)V" - ) + hideButtons(insertIndex, descriptor) + } + } ?: throw exception } private fun MutableMethod.hideButtons( insertIndex: Int, - offset: Int, descriptor: String ) { val insertRegister = getInstruction(insertIndex).registerA addInstructions( - insertIndex + offset, """ + insertIndex + 1, """ invoke-static {v$insertRegister}, $SHORTS->$descriptor move-result-object v$insertRegister """ diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/ShortsNavigationBarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsNavigationBarPatch.kt similarity index 55% rename from src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/ShortsNavigationBarPatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsNavigationBarPatch.kt index 07ff128f4..edf1ea0e5 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/ShortsNavigationBarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsNavigationBarPatch.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.shorts.shortscomponent +package app.revanced.patches.youtube.shorts.components import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction @@ -6,19 +6,17 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod -import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.BottomNavigationBarAlternativeFingerprint -import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.BottomNavigationBarFingerprint -import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.RenderBottomNavigationBarFingerprint -import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.SetPivotBarFingerprint +import app.revanced.patches.youtube.shorts.components.fingerprints.BottomNavigationBarFingerprint +import app.revanced.patches.youtube.shorts.components.fingerprints.RenderBottomNavigationBarFingerprint +import app.revanced.patches.youtube.shorts.components.fingerprints.SetPivotBarFingerprint import app.revanced.patches.youtube.utils.fingerprints.PivotBarCreateButtonViewFingerprint import app.revanced.patches.youtube.utils.integrations.Constants.SHORTS import app.revanced.util.exception -import com.android.tools.smali.dexlib2.Opcode +import app.revanced.util.getTargetIndexWithMethodReferenceName import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction object ShortsNavigationBarPatch : BytecodePatch( setOf( - BottomNavigationBarAlternativeFingerprint, BottomNavigationBarFingerprint, PivotBarCreateButtonViewFingerprint, RenderBottomNavigationBarFingerprint @@ -41,42 +39,24 @@ object ShortsNavigationBarPatch : BytecodePatch( } ?: throw PivotBarCreateButtonViewFingerprint.exception RenderBottomNavigationBarFingerprint.result?.let { - (context + val targetMethod = context .toMethodWalker(it.method) - .nextMethod(it.scanResult.patternScanResult!!.endIndex, true) + .nextMethod(it.scanResult.patternScanResult!!.startIndex + 1, true) .getMethod() as MutableMethod - ).apply { - addInstruction( - 0, - "invoke-static {}, $SHORTS->hideShortsPlayerNavigationBar()V" - ) - } + + targetMethod.addInstruction( + 0, + "invoke-static {}, $SHORTS->hideShortsPlayerNavigationBar()V" + ) } ?: throw RenderBottomNavigationBarFingerprint.exception BottomNavigationBarFingerprint.result?.let { it.mutableMethod.apply { - val insertIndex = it.scanResult.patternScanResult!!.endIndex - val insertRegister = getInstruction(insertIndex).registerA + val targetIndex = getTargetIndexWithMethodReferenceName("findViewById") + 1 + val insertRegister = getInstruction(targetIndex).registerA addInstructions( - insertIndex, """ - invoke-static {v$insertRegister}, $SHORTS->hideShortsPlayerNavigationBar(Landroid/view/View;)Landroid/view/View; - move-result-object v$insertRegister - """ - ) - } - } ?: BottomNavigationBarAlternativeFingerprint.result?.let { - it.mutableMethod.apply { - val targetIndex = it.scanResult.patternScanResult!!.endIndex + 3 - val insertIndex = - if (getInstruction(targetIndex).opcode == Opcode.IF_EQZ) - targetIndex - else - targetIndex + 1 - val insertRegister = getInstruction(insertIndex).registerA - - addInstructions( - insertIndex, """ + targetIndex + 1, """ invoke-static {v$insertRegister}, $SHORTS->hideShortsPlayerNavigationBar(Landroid/view/View;)Landroid/view/View; move-result-object v$insertRegister """ diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/ShortsSubscriptionsButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsSubscriptionsButtonPatch.kt similarity index 91% rename from src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/ShortsSubscriptionsButtonPatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsSubscriptionsButtonPatch.kt index 7ea0ea8b7..07f9679c2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/ShortsSubscriptionsButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsSubscriptionsButtonPatch.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.shorts.shortscomponent +package app.revanced.patches.youtube.shorts.components import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction @@ -6,9 +6,9 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.Patch -import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsSubscriptionsFingerprint -import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsSubscriptionsTabletFingerprint -import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsSubscriptionsTabletParentFingerprint +import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsSubscriptionsFingerprint +import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsSubscriptionsTabletFingerprint +import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsSubscriptionsTabletParentFingerprint import app.revanced.patches.youtube.utils.integrations.Constants.SHORTS import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelPlayerFooter import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelPlayerPausedStateButton diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/ShortsToolBarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsToolBarPatch.kt similarity index 91% rename from src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/ShortsToolBarPatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsToolBarPatch.kt index c2cf8168a..b44e12e32 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/ShortsToolBarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsToolBarPatch.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.shorts.shortscomponent +package app.revanced.patches.youtube.shorts.components import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels @@ -7,7 +7,7 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.smali.ExternalLabel -import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ToolBarBannerFingerprint +import app.revanced.patches.youtube.shorts.components.fingerprints.ToolBarBannerFingerprint import app.revanced.patches.youtube.utils.integrations.Constants.SHORTS import app.revanced.patches.youtube.utils.toolbar.ToolBarHookPatch import app.revanced.util.exception diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/BottomNavigationBarAlternativeFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/BottomNavigationBarFingerprint.kt similarity index 52% rename from src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/BottomNavigationBarAlternativeFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/BottomNavigationBarFingerprint.kt index bf4494b26..cc8004235 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/BottomNavigationBarAlternativeFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/BottomNavigationBarFingerprint.kt @@ -1,19 +1,12 @@ -package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints +package app.revanced.patches.youtube.shorts.components.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.MethodFingerprint import com.android.tools.smali.dexlib2.AccessFlags -import com.android.tools.smali.dexlib2.Opcode -object BottomNavigationBarAlternativeFingerprint : MethodFingerprint( +object BottomNavigationBarFingerprint : MethodFingerprint( returnType = "V", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, parameters = listOf("Landroid/view/View;", "Landroid/os/Bundle;"), - opcodes = listOf( - Opcode.IGET_OBJECT, - Opcode.IGET_OBJECT, - Opcode.IGET_OBJECT, - Opcode.INVOKE_VIRTUAL - ), strings = listOf("r_pfvc", "ReelWatchPaneFragmentViewModelKey") ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/RenderBottomNavigationBarFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/RenderBottomNavigationBarFingerprint.kt similarity index 54% rename from src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/RenderBottomNavigationBarFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/RenderBottomNavigationBarFingerprint.kt index 520a227d5..e263d7043 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/RenderBottomNavigationBarFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/RenderBottomNavigationBarFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints +package app.revanced.patches.youtube.shorts.components.fingerprints import app.revanced.patcher.fingerprint.MethodFingerprint import com.android.tools.smali.dexlib2.Opcode @@ -6,10 +6,11 @@ import com.android.tools.smali.dexlib2.Opcode object RenderBottomNavigationBarFingerprint : MethodFingerprint( returnType = "V", opcodes = listOf( - Opcode.CHECK_CAST, - Opcode.IGET_OBJECT, Opcode.CONST_STRING, - Opcode.INVOKE_VIRTUAL + Opcode.INVOKE_VIRTUAL, + Opcode.INVOKE_VIRTUAL, + Opcode.MOVE_RESULT, + Opcode.IF_NEZ ), - strings = listOf("r_as") + strings = listOf("r_ipl") ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/SetPivotBarFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/SetPivotBarFingerprint.kt similarity index 85% rename from src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/SetPivotBarFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/SetPivotBarFingerprint.kt index 6d68d2033..9377a1548 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/SetPivotBarFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/SetPivotBarFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints +package app.revanced.patches.youtube.shorts.components.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.MethodFingerprint diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsButtonFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsButtonFingerprint.kt new file mode 100644 index 000000000..c7cace601 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsButtonFingerprint.kt @@ -0,0 +1,20 @@ +package app.revanced.patches.youtube.shorts.components.fingerprints + +import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelDynRemix +import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelDynShare +import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelRightDislikeIcon +import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelRightLikeIcon +import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.RightComment +import app.revanced.util.containsWideLiteralInstructionIndex + +object ShortsButtonFingerprint : MethodFingerprint( + returnType = "V", + customFingerprint = { methodDef, _ -> + methodDef.containsWideLiteralInstructionIndex(ReelDynRemix) + && methodDef.containsWideLiteralInstructionIndex(ReelDynShare) + && methodDef.containsWideLiteralInstructionIndex(ReelRightDislikeIcon) + && methodDef.containsWideLiteralInstructionIndex(ReelRightLikeIcon) + && methodDef.containsWideLiteralInstructionIndex(RightComment) + }, +) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsInfoPanelFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsInfoPanelFingerprint.kt similarity index 85% rename from src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsInfoPanelFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsInfoPanelFingerprint.kt index c208126d5..0e9e7fb6f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsInfoPanelFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsInfoPanelFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints +package app.revanced.patches.youtube.shorts.components.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelPlayerInfoPanel diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsPaidPromotionFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsPaidPromotionFingerprint.kt new file mode 100644 index 000000000..86b9e7e3c --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsPaidPromotionFingerprint.kt @@ -0,0 +1,17 @@ +package app.revanced.patches.youtube.shorts.components.fingerprints + +import app.revanced.patcher.extensions.or +import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelPlayerBadge +import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelPlayerBadge2 +import app.revanced.util.containsWideLiteralInstructionIndex +import com.android.tools.smali.dexlib2.AccessFlags + +object ShortsPaidPromotionFingerprint : MethodFingerprint( + returnType = "V", + accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, + customFingerprint = { methodDef, _ -> + methodDef.containsWideLiteralInstructionIndex(ReelPlayerBadge) + && methodDef.containsWideLiteralInstructionIndex(ReelPlayerBadge2) + }, +) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsPivotFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsPivotFingerprint.kt similarity index 50% rename from src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsPivotFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsPivotFingerprint.kt index 6ccaf71d3..51d51c52e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsPivotFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsPivotFingerprint.kt @@ -1,13 +1,9 @@ -package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints +package app.revanced.patches.youtube.shorts.components.fingerprints -import app.revanced.patcher.extensions.or import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelPivotButton import app.revanced.util.fingerprint.LiteralValueFingerprint -import com.android.tools.smali.dexlib2.AccessFlags object ShortsPivotFingerprint : LiteralValueFingerprint( returnType = "V", - accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL, - parameters = listOf("Z", "Z", "L"), literalSupplier = { ReelPivotButton } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsPivotLegacyFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsPivotLegacyFingerprint.kt similarity index 86% rename from src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsPivotLegacyFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsPivotLegacyFingerprint.kt index 45f08b305..0502e069c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsPivotLegacyFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsPivotLegacyFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints +package app.revanced.patches.youtube.shorts.components.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelForcedMuteButton diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsSubscriptionsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsSubscriptionsFingerprint.kt similarity index 87% rename from src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsSubscriptionsFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsSubscriptionsFingerprint.kt index 274fa8aef..85c5a1cd5 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsSubscriptionsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsSubscriptionsFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints +package app.revanced.patches.youtube.shorts.components.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelPlayerPausedStateButton diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsSubscriptionsTabletFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsSubscriptionsTabletFingerprint.kt similarity index 86% rename from src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsSubscriptionsTabletFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsSubscriptionsTabletFingerprint.kt index e6c97b5da..652cd52b9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsSubscriptionsTabletFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsSubscriptionsTabletFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints +package app.revanced.patches.youtube.shorts.components.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.MethodFingerprint diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsSubscriptionsTabletParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsSubscriptionsTabletParentFingerprint.kt similarity index 86% rename from src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsSubscriptionsTabletParentFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsSubscriptionsTabletParentFingerprint.kt index 60cbe5b7f..4cfdbc062 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsSubscriptionsTabletParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ShortsSubscriptionsTabletParentFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints +package app.revanced.patches.youtube.shorts.components.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelPlayerFooter diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ToolBarBannerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ToolBarBannerFingerprint.kt similarity index 85% rename from src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ToolBarBannerFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ToolBarBannerFingerprint.kt index f9ebfec81..434285135 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ToolBarBannerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/components/fingerprints/ToolBarBannerFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints +package app.revanced.patches.youtube.shorts.components.fingerprints import app.revanced.patcher.fingerprint.MethodFingerprint import com.android.tools.smali.dexlib2.Opcode diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/BottomNavigationBarFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/BottomNavigationBarFingerprint.kt deleted file mode 100644 index 868d12937..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/BottomNavigationBarFingerprint.kt +++ /dev/null @@ -1,18 +0,0 @@ -package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints - -import app.revanced.patcher.fingerprint.MethodFingerprint -import com.android.tools.smali.dexlib2.Opcode - -object BottomNavigationBarFingerprint : MethodFingerprint( - returnType = "V", - opcodes = listOf( - Opcode.IGET_OBJECT, - Opcode.IGET_OBJECT, - Opcode.IGET_OBJECT, - Opcode.INVOKE_VIRTUAL, - Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT_OBJECT, - Opcode.IF_EQZ - ), - strings = listOf("r_pfvc", "navigation_endpoint_interaction_logging_extension") -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsCommentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsCommentFingerprint.kt deleted file mode 100644 index 4fd324fe9..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsCommentFingerprint.kt +++ /dev/null @@ -1,13 +0,0 @@ -package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints - -import app.revanced.patcher.extensions.or -import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.RightComment -import app.revanced.util.fingerprint.LiteralValueFingerprint -import com.android.tools.smali.dexlib2.AccessFlags - -object ShortsCommentFingerprint : LiteralValueFingerprint( - returnType = "V", - accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL, - parameters = listOf("Z", "Z", "L"), - literalSupplier = { RightComment } -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsDislikeFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsDislikeFingerprint.kt deleted file mode 100644 index 6cb41562c..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsDislikeFingerprint.kt +++ /dev/null @@ -1,13 +0,0 @@ -package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints - -import app.revanced.patcher.extensions.or -import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelRightDislikeIcon -import app.revanced.util.fingerprint.LiteralValueFingerprint -import com.android.tools.smali.dexlib2.AccessFlags - -object ShortsDislikeFingerprint : LiteralValueFingerprint( - returnType = "V", - accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL, - parameters = listOf("Z", "Z", "L"), - literalSupplier = { ReelRightDislikeIcon } -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsLikeFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsLikeFingerprint.kt deleted file mode 100644 index 48de0634e..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsLikeFingerprint.kt +++ /dev/null @@ -1,13 +0,0 @@ -package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints - -import app.revanced.patcher.extensions.or -import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelRightLikeIcon -import app.revanced.util.fingerprint.LiteralValueFingerprint -import com.android.tools.smali.dexlib2.AccessFlags - -object ShortsLikeFingerprint : LiteralValueFingerprint( - returnType = "V", - accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL, - parameters = listOf("Z", "Z", "L"), - literalSupplier = { ReelRightLikeIcon } -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsPaidPromotionFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsPaidPromotionFingerprint.kt deleted file mode 100644 index 6eb821fed..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsPaidPromotionFingerprint.kt +++ /dev/null @@ -1,12 +0,0 @@ -package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints - -import app.revanced.patcher.extensions.or -import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelPlayerBadge -import app.revanced.util.fingerprint.LiteralValueFingerprint -import com.android.tools.smali.dexlib2.AccessFlags - -object ShortsPaidPromotionFingerprint : LiteralValueFingerprint( - returnType = "V", - accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, - literalSupplier = { ReelPlayerBadge } -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsRemixFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsRemixFingerprint.kt deleted file mode 100644 index 03c476b60..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsRemixFingerprint.kt +++ /dev/null @@ -1,13 +0,0 @@ -package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints - -import app.revanced.patcher.extensions.or -import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelDynRemix -import app.revanced.util.fingerprint.LiteralValueFingerprint -import com.android.tools.smali.dexlib2.AccessFlags - -object ShortsRemixFingerprint : LiteralValueFingerprint( - returnType = "V", - accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL, - parameters = listOf("Z", "Z", "L"), - literalSupplier = { ReelDynRemix } -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsShareFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsShareFingerprint.kt deleted file mode 100644 index f4c558d26..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/shortscomponent/fingerprints/ShortsShareFingerprint.kt +++ /dev/null @@ -1,13 +0,0 @@ -package app.revanced.patches.youtube.shorts.shortscomponent.fingerprints - -import app.revanced.patcher.extensions.or -import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelDynShare -import app.revanced.util.fingerprint.LiteralValueFingerprint -import com.android.tools.smali.dexlib2.AccessFlags - -object ShortsShareFingerprint : LiteralValueFingerprint( - returnType = "V", - accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL, - parameters = listOf("Z", "Z", "L"), - literalSupplier = { ReelDynShare } -) \ No newline at end of file