fix(Sync for Reddit - Disable ads): fix compatibility with latest version

This commit is contained in:
oSumAtrIX 2023-07-18 00:36:37 +02:00
parent 6c013143a5
commit 1456577f11
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
2 changed files with 5 additions and 7 deletions

View File

@ -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",

View File

@ -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()
}