mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-04 16:44:29 +02:00
feat(YouTube/Hide shorts components): apply fingerprint compatible with the wider version
This commit is contained in:
parent
f50d2e7d0f
commit
3a37ce604f
@ -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.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
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.CompatiblePackage
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsCommentFingerprint
|
import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsButtonFingerprint
|
||||||
import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsDislikeFingerprint
|
import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsInfoPanelFingerprint
|
||||||
import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsInfoPanelFingerprint
|
import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsPaidPromotionFingerprint
|
||||||
import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsLikeFingerprint
|
import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsPivotFingerprint
|
||||||
import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsPaidPromotionFingerprint
|
import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsPivotLegacyFingerprint
|
||||||
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.utils.integrations.Constants.COMPONENTS_PATH
|
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.integrations.Constants.SHORTS
|
||||||
import app.revanced.patches.youtube.utils.litho.LithoFilterPatch
|
import app.revanced.patches.youtube.utils.litho.LithoFilterPatch
|
||||||
@ -86,15 +82,11 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
|||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object ShortsComponentPatch : BytecodePatch(
|
object ShortsComponentPatch : BytecodePatch(
|
||||||
setOf(
|
setOf(
|
||||||
ShortsCommentFingerprint,
|
ShortsButtonFingerprint,
|
||||||
ShortsDislikeFingerprint,
|
|
||||||
ShortsInfoPanelFingerprint,
|
ShortsInfoPanelFingerprint,
|
||||||
ShortsLikeFingerprint,
|
|
||||||
ShortsPaidPromotionFingerprint,
|
ShortsPaidPromotionFingerprint,
|
||||||
ShortsPivotFingerprint,
|
ShortsPivotFingerprint,
|
||||||
ShortsPivotLegacyFingerprint,
|
ShortsPivotLegacyFingerprint
|
||||||
ShortsRemixFingerprint,
|
|
||||||
ShortsShareFingerprint,
|
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
@ -102,59 +94,41 @@ object ShortsComponentPatch : BytecodePatch(
|
|||||||
/**
|
/**
|
||||||
* Comment button
|
* Comment button
|
||||||
*/
|
*/
|
||||||
ShortsCommentFingerprint.result?.let {
|
ShortsButtonFingerprint.hideButton(RightComment, "hideShortsPlayerCommentsButton", false)
|
||||||
it.mutableMethod.apply {
|
|
||||||
val insertIndex = getWideLiteralInstructionIndex(RightComment) + 3
|
|
||||||
|
|
||||||
hideButton(insertIndex, 1, "hideShortsPlayerCommentsButton")
|
|
||||||
}
|
|
||||||
} ?: throw ShortsCommentFingerprint.exception
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dislike button
|
* Dislike button
|
||||||
*/
|
*/
|
||||||
ShortsDislikeFingerprint.result?.let {
|
ShortsButtonFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val insertIndex = getWideLiteralInstructionIndex(ReelRightDislikeIcon)
|
val constIndex = getWideLiteralInstructionIndex(ReelRightDislikeIcon)
|
||||||
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
val constRegister = getInstruction<OneRegisterInstruction>(constIndex).registerA
|
||||||
|
|
||||||
val jumpIndex = getTargetIndex(insertIndex, Opcode.CONST_CLASS) + 2
|
val jumpIndex = getTargetIndex(constIndex, Opcode.CONST_CLASS) + 2
|
||||||
|
|
||||||
addInstructionsWithLabels(
|
addInstructionsWithLabels(
|
||||||
insertIndex + 1, """
|
constIndex + 1, """
|
||||||
invoke-static {}, $SHORTS->hideShortsPlayerDislikeButton()Z
|
invoke-static {}, $SHORTS->hideShortsPlayerDislikeButton()Z
|
||||||
move-result v$insertRegister
|
move-result v$constRegister
|
||||||
if-nez v$insertRegister, :hide
|
if-nez v$constRegister, :hide
|
||||||
const v$insertRegister, $ReelRightDislikeIcon
|
const v$constRegister, $ReelRightDislikeIcon
|
||||||
""", ExternalLabel("hide", getInstruction(jumpIndex))
|
""", ExternalLabel("hide", getInstruction(jumpIndex))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} ?: throw ShortsDislikeFingerprint.exception
|
} ?: throw ShortsButtonFingerprint.exception
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Info panel
|
* Info panel
|
||||||
*/
|
*/
|
||||||
ShortsInfoPanelFingerprint.result?.let {
|
ShortsInfoPanelFingerprint.hideButtons(ReelPlayerInfoPanel, "hideShortsPlayerInfoPanel(Landroid/view/ViewGroup;)Landroid/view/ViewGroup;")
|
||||||
it.mutableMethod.apply {
|
|
||||||
val insertIndex = getWideLiteralInstructionIndex(ReelPlayerInfoPanel) + 3
|
|
||||||
|
|
||||||
hideButtons(
|
|
||||||
insertIndex,
|
|
||||||
1,
|
|
||||||
"hideShortsPlayerInfoPanel(Landroid/view/ViewGroup;)Landroid/view/ViewGroup;"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} ?: throw ShortsInfoPanelFingerprint.exception
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Like button
|
* Like button
|
||||||
*/
|
*/
|
||||||
ShortsLikeFingerprint.result?.let {
|
ShortsButtonFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val insertIndex = getWideLiteralInstructionIndex(ReelRightLikeIcon)
|
val insertIndex = getWideLiteralInstructionIndex(ReelRightLikeIcon)
|
||||||
|
|
||||||
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
val jumpIndex = getTargetIndex(insertIndex, Opcode.CONST_CLASS) + 2
|
val jumpIndex = getTargetIndex(insertIndex, Opcode.CONST_CLASS) + 2
|
||||||
|
|
||||||
addInstructionsWithLabels(
|
addInstructionsWithLabels(
|
||||||
@ -166,41 +140,13 @@ object ShortsComponentPatch : BytecodePatch(
|
|||||||
""", ExternalLabel("hide", getInstruction(jumpIndex))
|
""", ExternalLabel("hide", getInstruction(jumpIndex))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} ?: throw ShortsLikeFingerprint.exception
|
} ?: throw ShortsButtonFingerprint.exception
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Paid promotion
|
* Paid promotion
|
||||||
*/
|
*/
|
||||||
ShortsPaidPromotionFingerprint.result?.let {
|
ShortsPaidPromotionFingerprint.hideButtons(ReelPlayerBadge, "hideShortsPlayerPaidPromotionBanner(Landroid/view/ViewStub;)Landroid/view/ViewStub;")
|
||||||
it.mutableMethod.apply {
|
ShortsPaidPromotionFingerprint.hideButtons(ReelPlayerBadge2, "hideShortsPlayerPaidPromotionBanner(Landroid/view/ViewStub;)Landroid/view/ViewStub;")
|
||||||
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
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pivot button
|
* Pivot button
|
||||||
@ -224,37 +170,21 @@ object ShortsComponentPatch : BytecodePatch(
|
|||||||
} ?: ShortsPivotFingerprint.result?.let {
|
} ?: ShortsPivotFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val targetIndex = getWideLiteralInstructionIndex(ReelPivotButton)
|
val targetIndex = getWideLiteralInstructionIndex(ReelPivotButton)
|
||||||
val insertIndex = getTargetIndexReversed(targetIndex, Opcode.INVOKE_STATIC) + 2
|
val insertIndex = getTargetIndexReversed(targetIndex, Opcode.INVOKE_STATIC) + 1
|
||||||
|
|
||||||
hideButtons(
|
hideButtons(insertIndex, "hideShortsPlayerPivotButton(Ljava/lang/Object;)Ljava/lang/Object;")
|
||||||
insertIndex,
|
|
||||||
0,
|
|
||||||
"hideShortsPlayerPivotButton(Ljava/lang/Object;)Ljava/lang/Object;"
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
} ?: throw ShortsPivotFingerprint.exception
|
} ?: throw ShortsPivotFingerprint.exception
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remix button
|
* Remix button
|
||||||
*/
|
*/
|
||||||
ShortsRemixFingerprint.result?.let {
|
ShortsButtonFingerprint.hideButton(ReelDynRemix, "hideShortsPlayerRemixButton", true)
|
||||||
it.mutableMethod.apply {
|
|
||||||
val insertIndex = getWideLiteralInstructionIndex(ReelDynRemix) - 2
|
|
||||||
|
|
||||||
hideButton(insertIndex, 0, "hideShortsPlayerRemixButton")
|
|
||||||
}
|
|
||||||
} ?: throw ShortsRemixFingerprint.exception
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Share button
|
* Share button
|
||||||
*/
|
*/
|
||||||
ShortsShareFingerprint.result?.let {
|
ShortsButtonFingerprint.hideButton(ReelDynShare, "hideShortsPlayerShareButton", true)
|
||||||
it.mutableMethod.apply {
|
|
||||||
val insertIndex = getWideLiteralInstructionIndex(ReelDynShare) - 2
|
|
||||||
|
|
||||||
hideButton(insertIndex, 0, "hideShortsPlayerShareButton")
|
|
||||||
}
|
|
||||||
} ?: throw ShortsShareFingerprint.exception
|
|
||||||
|
|
||||||
LithoFilterPatch.addFilter("$COMPONENTS_PATH/ShortsFilter;")
|
LithoFilterPatch.addFilter("$COMPONENTS_PATH/ShortsFilter;")
|
||||||
|
|
||||||
@ -274,28 +204,50 @@ object ShortsComponentPatch : BytecodePatch(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun MutableMethod.hideButton(
|
private fun MethodFingerprint.hideButton(
|
||||||
insertIndex: Int,
|
id: Long,
|
||||||
offset: Int,
|
descriptor: String,
|
||||||
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<OneRegisterInstruction>(insertIndex).registerA
|
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
insertIndex + offset,
|
insertIndex,
|
||||||
"invoke-static {v$insertRegister}, $SHORTS->$descriptor(Landroid/view/View;)V"
|
"invoke-static {v$insertRegister}, $SHORTS->$descriptor(Landroid/view/View;)V"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
} ?: throw exception
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun MethodFingerprint.hideButtons(
|
||||||
|
id: Long,
|
||||||
|
descriptor: String
|
||||||
|
) {
|
||||||
|
result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val constIndex = getWideLiteralInstructionIndex(id)
|
||||||
|
val insertIndex = getTargetIndex(constIndex, Opcode.CHECK_CAST)
|
||||||
|
|
||||||
|
hideButtons(insertIndex, descriptor)
|
||||||
|
}
|
||||||
|
} ?: throw exception
|
||||||
|
}
|
||||||
|
|
||||||
private fun MutableMethod.hideButtons(
|
private fun MutableMethod.hideButtons(
|
||||||
insertIndex: Int,
|
insertIndex: Int,
|
||||||
offset: Int,
|
|
||||||
descriptor: String
|
descriptor: String
|
||||||
) {
|
) {
|
||||||
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
insertIndex + offset, """
|
insertIndex + 1, """
|
||||||
invoke-static {v$insertRegister}, $SHORTS->$descriptor
|
invoke-static {v$insertRegister}, $SHORTS->$descriptor
|
||||||
move-result-object v$insertRegister
|
move-result-object v$insertRegister
|
||||||
"""
|
"""
|
@ -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.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
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.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.BottomNavigationBarAlternativeFingerprint
|
import app.revanced.patches.youtube.shorts.components.fingerprints.BottomNavigationBarFingerprint
|
||||||
import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.BottomNavigationBarFingerprint
|
import app.revanced.patches.youtube.shorts.components.fingerprints.RenderBottomNavigationBarFingerprint
|
||||||
import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.RenderBottomNavigationBarFingerprint
|
import app.revanced.patches.youtube.shorts.components.fingerprints.SetPivotBarFingerprint
|
||||||
import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.SetPivotBarFingerprint
|
|
||||||
import app.revanced.patches.youtube.utils.fingerprints.PivotBarCreateButtonViewFingerprint
|
import app.revanced.patches.youtube.utils.fingerprints.PivotBarCreateButtonViewFingerprint
|
||||||
import app.revanced.patches.youtube.utils.integrations.Constants.SHORTS
|
import app.revanced.patches.youtube.utils.integrations.Constants.SHORTS
|
||||||
import app.revanced.util.exception
|
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
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
object ShortsNavigationBarPatch : BytecodePatch(
|
object ShortsNavigationBarPatch : BytecodePatch(
|
||||||
setOf(
|
setOf(
|
||||||
BottomNavigationBarAlternativeFingerprint,
|
|
||||||
BottomNavigationBarFingerprint,
|
BottomNavigationBarFingerprint,
|
||||||
PivotBarCreateButtonViewFingerprint,
|
PivotBarCreateButtonViewFingerprint,
|
||||||
RenderBottomNavigationBarFingerprint
|
RenderBottomNavigationBarFingerprint
|
||||||
@ -41,42 +39,24 @@ object ShortsNavigationBarPatch : BytecodePatch(
|
|||||||
} ?: throw PivotBarCreateButtonViewFingerprint.exception
|
} ?: throw PivotBarCreateButtonViewFingerprint.exception
|
||||||
|
|
||||||
RenderBottomNavigationBarFingerprint.result?.let {
|
RenderBottomNavigationBarFingerprint.result?.let {
|
||||||
(context
|
val targetMethod = context
|
||||||
.toMethodWalker(it.method)
|
.toMethodWalker(it.method)
|
||||||
.nextMethod(it.scanResult.patternScanResult!!.endIndex, true)
|
.nextMethod(it.scanResult.patternScanResult!!.startIndex + 1, true)
|
||||||
.getMethod() as MutableMethod
|
.getMethod() as MutableMethod
|
||||||
).apply {
|
|
||||||
addInstruction(
|
targetMethod.addInstruction(
|
||||||
0,
|
0,
|
||||||
"invoke-static {}, $SHORTS->hideShortsPlayerNavigationBar()V"
|
"invoke-static {}, $SHORTS->hideShortsPlayerNavigationBar()V"
|
||||||
)
|
)
|
||||||
}
|
|
||||||
} ?: throw RenderBottomNavigationBarFingerprint.exception
|
} ?: throw RenderBottomNavigationBarFingerprint.exception
|
||||||
|
|
||||||
BottomNavigationBarFingerprint.result?.let {
|
BottomNavigationBarFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
val targetIndex = getTargetIndexWithMethodReferenceName("findViewById") + 1
|
||||||
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
val insertRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
insertIndex, """
|
targetIndex + 1, """
|
||||||
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<OneRegisterInstruction>(insertIndex).registerA
|
|
||||||
|
|
||||||
addInstructions(
|
|
||||||
insertIndex, """
|
|
||||||
invoke-static {v$insertRegister}, $SHORTS->hideShortsPlayerNavigationBar(Landroid/view/View;)Landroid/view/View;
|
invoke-static {v$insertRegister}, $SHORTS->hideShortsPlayerNavigationBar(Landroid/view/View;)Landroid/view/View;
|
||||||
move-result-object v$insertRegister
|
move-result-object v$insertRegister
|
||||||
"""
|
"""
|
@ -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.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
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.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsSubscriptionsFingerprint
|
import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsSubscriptionsFingerprint
|
||||||
import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsSubscriptionsTabletFingerprint
|
import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsSubscriptionsTabletFingerprint
|
||||||
import app.revanced.patches.youtube.shorts.shortscomponent.fingerprints.ShortsSubscriptionsTabletParentFingerprint
|
import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsSubscriptionsTabletParentFingerprint
|
||||||
import app.revanced.patches.youtube.utils.integrations.Constants.SHORTS
|
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.ReelPlayerFooter
|
||||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelPlayerPausedStateButton
|
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelPlayerPausedStateButton
|
@ -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.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
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.patch.annotation.Patch
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
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.integrations.Constants.SHORTS
|
||||||
import app.revanced.patches.youtube.utils.toolbar.ToolBarHookPatch
|
import app.revanced.patches.youtube.utils.toolbar.ToolBarHookPatch
|
||||||
import app.revanced.util.exception
|
import app.revanced.util.exception
|
@ -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.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
|
|
||||||
object BottomNavigationBarAlternativeFingerprint : MethodFingerprint(
|
object BottomNavigationBarFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf("Landroid/view/View;", "Landroid/os/Bundle;"),
|
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")
|
strings = listOf("r_pfvc", "ReelWatchPaneFragmentViewModelKey")
|
||||||
)
|
)
|
@ -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 app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
@ -6,10 +6,11 @@ import com.android.tools.smali.dexlib2.Opcode
|
|||||||
object RenderBottomNavigationBarFingerprint : MethodFingerprint(
|
object RenderBottomNavigationBarFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.CHECK_CAST,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.CONST_STRING,
|
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")
|
||||||
)
|
)
|
@ -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.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
@ -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)
|
||||||
|
},
|
||||||
|
)
|
@ -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.extensions.or
|
||||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelPlayerInfoPanel
|
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelPlayerInfoPanel
|
@ -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)
|
||||||
|
},
|
||||||
|
)
|
@ -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.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelPivotButton
|
||||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
|
||||||
|
|
||||||
object ShortsPivotFingerprint : LiteralValueFingerprint(
|
object ShortsPivotFingerprint : LiteralValueFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
|
||||||
parameters = listOf("Z", "Z", "L"),
|
|
||||||
literalSupplier = { ReelPivotButton }
|
literalSupplier = { ReelPivotButton }
|
||||||
)
|
)
|
@ -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.extensions.or
|
||||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelForcedMuteButton
|
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelForcedMuteButton
|
@ -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.extensions.or
|
||||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelPlayerPausedStateButton
|
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelPlayerPausedStateButton
|
@ -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.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
@ -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.extensions.or
|
||||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelPlayerFooter
|
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelPlayerFooter
|
@ -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 app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
@ -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")
|
|
||||||
)
|
|
@ -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 }
|
|
||||||
)
|
|
@ -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 }
|
|
||||||
)
|
|
@ -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 }
|
|
||||||
)
|
|
@ -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 }
|
|
||||||
)
|
|
@ -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 }
|
|
||||||
)
|
|
@ -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 }
|
|
||||||
)
|
|
Loading…
x
Reference in New Issue
Block a user