2023-06-18 01:45:17 +02:00
|
|
|
package app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.patch
|
2023-05-07 18:15:30 +02:00
|
|
|
|
|
|
|
import app.revanced.patcher.annotation.Description
|
|
|
|
import app.revanced.patcher.data.BytecodeContext
|
2023-06-07 03:46:13 +02:00
|
|
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
2023-05-07 18:15:30 +02:00
|
|
|
import app.revanced.patcher.patch.BytecodePatch
|
2023-08-27 04:26:14 +02:00
|
|
|
import app.revanced.patcher.patch.PatchResult
|
|
|
|
import app.revanced.patcher.patch.PatchResultSuccess
|
2023-07-18 00:36:37 +02:00
|
|
|
import app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.fingerprints.PiracyDetectionFingerprint
|
2023-05-07 18:15:30 +02:00
|
|
|
|
|
|
|
@Description("Disables detection of modified versions.")
|
|
|
|
class DisablePiracyDetectionPatch : BytecodePatch(listOf(PiracyDetectionFingerprint)) {
|
2023-08-27 04:26:14 +02:00
|
|
|
override fun execute(context: BytecodeContext): PatchResult {
|
2023-07-18 00:36:37 +02:00
|
|
|
// 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.
|
2023-05-07 18:15:30 +02:00
|
|
|
PiracyDetectionFingerprint.result?.mutableMethod?.apply {
|
2023-06-07 03:46:13 +02:00
|
|
|
addInstruction(
|
2023-05-07 18:15:30 +02:00
|
|
|
0,
|
|
|
|
"""
|
2023-06-07 03:46:13 +02:00
|
|
|
return-void
|
|
|
|
"""
|
2023-05-07 18:15:30 +02:00
|
|
|
)
|
2023-07-18 00:36:37 +02:00
|
|
|
}
|
2023-08-27 04:26:14 +02:00
|
|
|
|
|
|
|
return PatchResultSuccess()
|
2023-05-07 18:15:30 +02:00
|
|
|
}
|
|
|
|
}
|