diff --git a/src/main/kotlin/app/revanced/patches/moneymanager/annotations/UnlockProCompatibility.kt b/src/main/kotlin/app/revanced/patches/moneymanager/annotations/UnlockProCompatibility.kt new file mode 100644 index 000000000..8a46c0e2d --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/moneymanager/annotations/UnlockProCompatibility.kt @@ -0,0 +1,9 @@ +package app.revanced.patches.moneymanager.annotations + +import app.revanced.patcher.annotation.Compatibility +import app.revanced.patcher.annotation.Package + +@Compatibility([Package("com.ithebk.expensemanager")]) +@Target(AnnotationTarget.CLASS) +@Retention(AnnotationRetention.RUNTIME) +internal annotation class UnlockProCompatibility \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/moneymanager/fingerprints/UnlockProFingerprint.kt b/src/main/kotlin/app/revanced/patches/moneymanager/fingerprints/UnlockProFingerprint.kt new file mode 100644 index 000000000..9ea14f8ac --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/moneymanager/fingerprints/UnlockProFingerprint.kt @@ -0,0 +1,19 @@ +package app.revanced.patches.moneymanager.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 + +object UnlockProFingerprint : MethodFingerprint( + "Z", + AccessFlags.STATIC or AccessFlags.SYNTHETIC, + parameters = listOf("L"), + opcodes = listOf( + Opcode.IGET_BOOLEAN, + Opcode.RETURN + ), + customFingerprint = { methodDef -> + methodDef.definingClass.endsWith("MainActivity;") + } +) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/moneymanager/patch/UnlockProPatch.kt b/src/main/kotlin/app/revanced/patches/moneymanager/patch/UnlockProPatch.kt new file mode 100644 index 000000000..e857e7140 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/moneymanager/patch/UnlockProPatch.kt @@ -0,0 +1,34 @@ +package app.revanced.patches.moneymanager.patch + +import app.revanced.patcher.annotation.Description +import app.revanced.patcher.annotation.Name +import app.revanced.patcher.annotation.Version +import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.extensions.addInstructions +import app.revanced.patcher.patch.BytecodePatch +import app.revanced.patcher.patch.PatchResult +import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.moneymanager.annotations.UnlockProCompatibility +import app.revanced.patches.moneymanager.fingerprints.UnlockProFingerprint + +@Patch +@Name("unlock-pro") +@Description("Unlocks pro features.") +@UnlockProCompatibility +@Version("0.0.1") +class UnlockProPatch : BytecodePatch( + listOf(UnlockProFingerprint) +) { + override fun execute(context: BytecodeContext): PatchResult { + UnlockProFingerprint.result!!.mutableMethod.addInstructions( + 0, + """ + const/4 v0, 0x1 + + return v0 + """ + ) + return PatchResultSuccess() + } +} \ No newline at end of file