diff --git a/src/main/kotlin/app/revanced/patches/vsco/misc/pro/fingerprints/RevCatSubscriptionFingerprint.kt b/src/main/kotlin/app/revanced/patches/vsco/misc/pro/fingerprints/RevCatSubscriptionFingerprint.kt new file mode 100644 index 0000000000..7ad72c5bc0 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/vsco/misc/pro/fingerprints/RevCatSubscriptionFingerprint.kt @@ -0,0 +1,13 @@ +package app.revanced.patches.vsco.misc.pro.fingerprints + +import org.jf.dexlib2.AccessFlags +import app.revanced.patcher.extensions.or +import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint + +object RevCatSubscriptionFingerprint : MethodFingerprint( + returnType = "V", + strings = listOf("use_debug_subscription_settings"), + customFingerprint = { methodDef, _ -> + methodDef.definingClass.endsWith("/RevCatSubscriptionSettingsRepository;") + } +) diff --git a/src/main/kotlin/app/revanced/patches/vsco/misc/pro/patch/UnlockProPatch.kt b/src/main/kotlin/app/revanced/patches/vsco/misc/pro/patch/UnlockProPatch.kt new file mode 100644 index 0000000000..1b428ba4b4 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/vsco/misc/pro/patch/UnlockProPatch.kt @@ -0,0 +1,35 @@ +package app.revanced.patches.vsco.misc.pro.patch + +import app.revanced.extensions.toErrorResult +import app.revanced.patcher.annotation.* +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.vsco.misc.pro.fingerprints.RevCatSubscriptionFingerprint + + +@Patch +@Name("unlock-pro") +@Description("Unlocks pro features.") +@Compatibility([Package("com.vsco.cam")]) +@Version("0.0.1") +class UnlockProPatch : BytecodePatch( + listOf(RevCatSubscriptionFingerprint) +) { + override fun execute(context: BytecodeContext): PatchResult { + RevCatSubscriptionFingerprint.result?.mutableMethod?.apply { + // Set isSubscribed to true. + addInstructions( + 0, + """ + const p1, 0x1 + """ + ) + } ?: return RevCatSubscriptionFingerprint.toErrorResult() + + return PatchResultSuccess() + } +}