From fe628ba909d89ea0bf3d95fe94ca78ef819677da Mon Sep 17 00:00:00 2001 From: TheJeterLP Date: Mon, 11 Jul 2022 08:56:33 +0200 Subject: [PATCH] fix: `autorepeat-by-default` patch (#148) --- .../autorepeat/annotations/AutoRepeatCompatibility.kt | 2 +- .../autorepeat/fingerprints/AutoRepeatFingerprint.kt | 10 +++++----- .../fingerprints/AutoRepeatParentFingerprint.kt | 4 ++-- .../autorepeat/patch/AutoRepeatPatch.kt | 11 +++++------ 4 files changed, 13 insertions(+), 14 deletions(-) rename src/main/kotlin/app/revanced/patches/youtube/{layout => misc}/autorepeat/annotations/AutoRepeatCompatibility.kt (83%) rename src/main/kotlin/app/revanced/patches/youtube/{layout => misc}/autorepeat/fingerprints/AutoRepeatFingerprint.kt (77%) rename src/main/kotlin/app/revanced/patches/youtube/{layout => misc}/autorepeat/fingerprints/AutoRepeatParentFingerprint.kt (87%) rename src/main/kotlin/app/revanced/patches/youtube/{layout => misc}/autorepeat/patch/AutoRepeatPatch.kt (88%) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/autorepeat/annotations/AutoRepeatCompatibility.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/annotations/AutoRepeatCompatibility.kt similarity index 83% rename from src/main/kotlin/app/revanced/patches/youtube/layout/autorepeat/annotations/AutoRepeatCompatibility.kt rename to src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/annotations/AutoRepeatCompatibility.kt index 30a8c29ca..b4c826c1b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/autorepeat/annotations/AutoRepeatCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/annotations/AutoRepeatCompatibility.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.layout.autorepeat.annotations +package app.revanced.patches.youtube.misc.autorepeat.annotations import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Package diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/autorepeat/fingerprints/AutoRepeatFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/fingerprints/AutoRepeatFingerprint.kt similarity index 77% rename from src/main/kotlin/app/revanced/patches/youtube/layout/autorepeat/fingerprints/AutoRepeatFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/fingerprints/AutoRepeatFingerprint.kt index 83722beb7..c5a65f4e8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/autorepeat/fingerprints/AutoRepeatFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/fingerprints/AutoRepeatFingerprint.kt @@ -1,12 +1,12 @@ -package app.revanced.patches.youtube.layout.autorepeat.fingerprints +package app.revanced.patches.youtube.misc.autorepeat.fingerprints import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod -import app.revanced.patches.youtube.layout.autorepeat.annotations.AutoRepeatCompatibility +import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint +import app.revanced.patches.youtube.misc.autorepeat.annotations.AutoRepeatCompatibility import org.jf.dexlib2.AccessFlags @Name("auto-repeat-fingerprint") @@ -25,8 +25,8 @@ public final void ae() { object AutoRepeatFingerprint : MethodFingerprint( "V", AccessFlags.PUBLIC or AccessFlags.FINAL, + listOf(), null, null, - null, - customFingerprint = { methodDef -> methodDef.implementation!!.instructions.count() == 3 } + customFingerprint = { methodDef -> methodDef.implementation!!.instructions.count() == 3 && methodDef.annotations.isEmpty()} ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/autorepeat/fingerprints/AutoRepeatParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/fingerprints/AutoRepeatParentFingerprint.kt similarity index 87% rename from src/main/kotlin/app/revanced/patches/youtube/layout/autorepeat/fingerprints/AutoRepeatParentFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/fingerprints/AutoRepeatParentFingerprint.kt index 6f60ac676..a4d0c02f4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/autorepeat/fingerprints/AutoRepeatParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/fingerprints/AutoRepeatParentFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.layout.autorepeat.fingerprints +package app.revanced.patches.youtube.misc.autorepeat.fingerprints import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version @@ -6,7 +6,7 @@ import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod -import app.revanced.patches.youtube.layout.autorepeat.annotations.AutoRepeatCompatibility +import app.revanced.patches.youtube.misc.autorepeat.annotations.AutoRepeatCompatibility import org.jf.dexlib2.AccessFlags @Name("auto-repeat-parent-fingerprint") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/autorepeat/patch/AutoRepeatPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/patch/AutoRepeatPatch.kt similarity index 88% rename from src/main/kotlin/app/revanced/patches/youtube/layout/autorepeat/patch/AutoRepeatPatch.kt rename to src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/patch/AutoRepeatPatch.kt index c429a68b3..8d567d59d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/autorepeat/patch/AutoRepeatPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/patch/AutoRepeatPatch.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.layout.autorepeat.patch +package app.revanced.patches.youtube.misc.autorepeat.patch import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name @@ -13,9 +13,9 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.Dependencies import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.impl.BytecodePatch -import app.revanced.patches.youtube.layout.autorepeat.annotations.AutoRepeatCompatibility -import app.revanced.patches.youtube.layout.autorepeat.fingerprints.AutoRepeatFingerprint -import app.revanced.patches.youtube.layout.autorepeat.fingerprints.AutoRepeatParentFingerprint +import app.revanced.patches.youtube.misc.autorepeat.annotations.AutoRepeatCompatibility +import app.revanced.patches.youtube.misc.autorepeat.fingerprints.AutoRepeatFingerprint +import app.revanced.patches.youtube.misc.autorepeat.fingerprints.AutoRepeatParentFingerprint import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch @Patch(include = false) @@ -50,8 +50,7 @@ class AutoRepeatPatch : BytecodePatch( invoke-static {}, Lapp/revanced/integrations/patches/AutoRepeatPatch;->shouldAutoRepeat()Z move-result v0 if-eqz v0, :noautorepeat - const/4 v0, 0x0 - invoke-virtual {}, $methodToCall + invoke-virtual {p0}, $methodToCall :noautorepeat return-void """