fix: add v17.28.34 compatiblity for the hide-shorts-button patch (#224)

This commit is contained in:
Alberto Ponces 2022-07-23 17:49:03 +01:00 committed by GitHub
parent 13b3626044
commit 76166bb35f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 25 deletions

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39") "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34", "17.24.35", "17.25.34", "17.26.35", "17.27.39", "17.28.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@ -3,7 +3,6 @@ package app.revanced.patches.youtube.layout.shorts.button.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.shorts.button.annotations.ShortsButtonCompatibility import app.revanced.patches.youtube.layout.shorts.button.annotations.ShortsButtonCompatibility
@ -14,7 +13,6 @@ import org.jf.dexlib2.Opcode
@MatchingMethod( @MatchingMethod(
"Lknw;", "z" "Lknw;", "z"
) )
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@ShortsButtonCompatibility @ShortsButtonCompatibility
@Version("0.0.1") @Version("0.0.1")
object PivotBarButtonsViewFingerprint : MethodFingerprint( object PivotBarButtonsViewFingerprint : MethodFingerprint(
@ -22,28 +20,19 @@ object PivotBarButtonsViewFingerprint : MethodFingerprint(
AccessFlags.PUBLIC or AccessFlags.FINAL, AccessFlags.PUBLIC or AccessFlags.FINAL,
listOf("Z"), listOf("Z"),
listOf( listOf(
Opcode.NEW_INSTANCE, // new StateListDrawable() Opcode.INVOKE_VIRTUAL_RANGE,
Opcode.INVOKE_DIRECT,
Opcode.NEW_ARRAY,
Opcode.CONST,
Opcode.CONST_16,
Opcode.APUT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT, Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_STATIC, Opcode.GOTO,
Opcode.MOVE_RESULT_OBJECT, Opcode.IGET_OBJECT,
Opcode.INVOKE_VIRTUAL, Opcode.IF_NEZ,
Opcode.SGET_OBJECT, Opcode.SGET_OBJECT,
Opcode.INVOKE_VIRTUAL, Opcode.IGET,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_STATIC, Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT, Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL, Opcode.IF_NEZ,
Opcode.MOVE_OBJECT, Opcode.SGET_OBJECT,
Opcode.MOVE_OBJECT, Opcode.INVOKE_INTERFACE,
Opcode.MOVE, Opcode.MOVE_RESULT,
Opcode.MOVE_OBJECT, Opcode.IGET
Opcode.INVOKE_VIRTUAL_RANGE, // pivotBar.getView(drawable, tabName, z, i, map, akebVar, optional)
Opcode.MOVE_RESULT_OBJECT,
) )
) )

View File

@ -35,7 +35,7 @@ class ShortsButtonRemoverPatch : BytecodePatch(
val buttonsViewResult = PivotBarButtonsViewFingerprint.result!! val buttonsViewResult = PivotBarButtonsViewFingerprint.result!!
val buttonsViewImplementation = buttonsViewResult.mutableMethod.implementation!! val buttonsViewImplementation = buttonsViewResult.mutableMethod.implementation!!
val moveViewInstruction = buttonsViewImplementation.instructions[buttonsViewResult.patternScanResult!!.endIndex] val moveViewInstruction = buttonsViewImplementation.instructions[buttonsViewResult.patternScanResult!!.startIndex + 1]
val viewRegister = (moveViewInstruction as OneRegisterInstruction).registerA val viewRegister = (moveViewInstruction as OneRegisterInstruction).registerA
@ -48,7 +48,7 @@ class ShortsButtonRemoverPatch : BytecodePatch(
// Hide the button view via proxy by passing it to the hideShortsButton method // Hide the button view via proxy by passing it to the hideShortsButton method
// It only hides it if the last tab name is "TAB_SHORTS" // It only hides it if the last tab name is "TAB_SHORTS"
buttonsViewResult.mutableMethod.addInstruction( buttonsViewResult.mutableMethod.addInstruction(
buttonsViewResult.patternScanResult!!.endIndex + 2, buttonsViewResult.patternScanResult!!.startIndex + 3,
"invoke-static { v$viewRegister }, Lapp/revanced/integrations/patches/HideShortsButtonPatch;->hideShortsButton(Landroid/view/View;)V" "invoke-static { v$viewRegister }, Lapp/revanced/integrations/patches/HideShortsButtonPatch;->hideShortsButton(Landroid/view/View;)V"
) )