mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 21:27:43 +02:00
chore(YouTube): replace with a fingerprint that supports a wider range of versions
This commit is contained in:
@ -10,6 +10,7 @@ import app.revanced.patches.shared.litho.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.player.descriptions.fingerprints.EngagementPanelTitleFingerprint
|
||||
import app.revanced.patches.youtube.player.descriptions.fingerprints.EngagementPanelTitleParentFingerprint
|
||||
import app.revanced.patches.youtube.player.descriptions.fingerprints.TextViewComponentFingerprint
|
||||
import app.revanced.patches.youtube.player.descriptions.fingerprints.TextViewComponentFingerprint.indexOfTextIsSelectableInstruction
|
||||
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
|
||||
import app.revanced.patches.youtube.utils.fingerprints.RollingNumberTextViewAnimationUpdateFingerprint
|
||||
import app.revanced.patches.youtube.utils.fingerprints.RollingNumberTextViewFingerprint
|
||||
@ -94,8 +95,7 @@ object DescriptionComponentsPatch : BaseBytecodePatch(
|
||||
if (SettingsPatch.upward1902) {
|
||||
TextViewComponentFingerprint.resultOrThrow().let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex =
|
||||
getTargetIndexWithMethodReferenceNameOrThrow("setTextIsSelectable")
|
||||
val insertIndex = indexOfTextIsSelectableInstruction(this)
|
||||
val insertInstruction = getInstruction<FiveRegisterInstruction>(insertIndex)
|
||||
|
||||
replaceInstruction(
|
||||
|
@ -1,14 +1,30 @@
|
||||
package app.revanced.patches.youtube.player.descriptions.fingerprints
|
||||
|
||||
import app.revanced.util.fingerprint.MethodReferenceNameFingerprint
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.youtube.player.descriptions.fingerprints.TextViewComponentFingerprint.indexOfTextIsSelectableInstruction
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.indexOfFirstInstruction
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.Method
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
/**
|
||||
* This fingerprint is compatible with YouTube v18.35.xx~
|
||||
* Nonetheless, the patch works in YouTube v19.02.xx~
|
||||
*/
|
||||
internal object TextViewComponentFingerprint : MethodReferenceNameFingerprint(
|
||||
internal object TextViewComponentFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
opcodes = listOf(Opcode.CMPL_FLOAT),
|
||||
reference = { "setBreakStrategy" }
|
||||
)
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.implementation != null &&
|
||||
indexOfTextIsSelectableInstruction(methodDef) >= 0
|
||||
},
|
||||
) {
|
||||
fun indexOfTextIsSelectableInstruction(methodDef: Method) =
|
||||
methodDef.indexOfFirstInstruction {
|
||||
val reference = getReference<MethodReference>()
|
||||
opcode == Opcode.INVOKE_VIRTUAL &&
|
||||
reference?.name == "setTextIsSelectable" &&
|
||||
reference.definingClass != "Landroid/widget/TextView;"
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ object FullscreenComponentsPatch : BaseBytecodePatch(
|
||||
|
||||
addInstruction(
|
||||
checkCastIndex + 1,
|
||||
"invoke-static {v$insertRegister}, $PLAYER_CLASS_DESCRIPTOR->setQuickActionMargin(Landroid/widget/FrameLayout;)V"
|
||||
"invoke-static {v$insertRegister}, $PLAYER_CLASS_DESCRIPTOR->setQuickActionMargin(Landroid/view/View;)V"
|
||||
)
|
||||
|
||||
addInstruction(
|
||||
|
Reference in New Issue
Block a user