From 1456577f11c4a7e49d6c1ba0103b919dc487f4cf Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Tue, 18 Jul 2023 00:36:37 +0200 Subject: [PATCH] fix(Sync for Reddit - Disable ads): fix compatibility with latest version --- .../piracy/fingerprints/PiracyDetectionFingerprint.kt | 3 +-- .../piracy/patch/DisablePiracyDetectionPatch.kt | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/detection/piracy/fingerprints/PiracyDetectionFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/detection/piracy/fingerprints/PiracyDetectionFingerprint.kt index d3c87f36..f420ce16 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/detection/piracy/fingerprints/PiracyDetectionFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/detection/piracy/fingerprints/PiracyDetectionFingerprint.kt @@ -1,11 +1,10 @@ -package app.revanced.patches.syncforreddit.detection.piracy.fingerprints +package app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.instruction.ReferenceInstruction -import org.jf.dexlib2.iface.reference.TypeReference object PiracyDetectionFingerprint : MethodFingerprint( returnType = "V", diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/detection/piracy/patch/DisablePiracyDetectionPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/detection/piracy/patch/DisablePiracyDetectionPatch.kt index b0e63f68..f0d73060 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/detection/piracy/patch/DisablePiracyDetectionPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/detection/piracy/patch/DisablePiracyDetectionPatch.kt @@ -1,19 +1,18 @@ package app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.patch -import app.revanced.extensions.toErrorResult import app.revanced.patcher.annotation.Description -import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.patches.syncforreddit.detection.piracy.fingerprints.PiracyDetectionFingerprint +import app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.fingerprints.PiracyDetectionFingerprint @Description("Disables detection of modified versions.") -@Version("0.0.1") class DisablePiracyDetectionPatch : BytecodePatch(listOf(PiracyDetectionFingerprint)) { override fun execute(context: BytecodeContext): PatchResult { + // Do not return an error if the fingerprint is not resolved. + // This is fine because new versions of the target app do not need this patch. PiracyDetectionFingerprint.result?.mutableMethod?.apply { addInstruction( 0, @@ -21,7 +20,7 @@ class DisablePiracyDetectionPatch : BytecodePatch(listOf(PiracyDetectionFingerpr return-void """ ) - } ?: return PiracyDetectionFingerprint.toErrorResult() + } return PatchResultSuccess() }