Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(vsco): add unlock-pro patch #2168

Merged
merged 4 commits into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package app.revanced.patches.vsco.misc.pro.annotations

import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package

@Compatibility([Package("com.vsco.cam")])
internal annotation class ProUnlockCompatibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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(
redphx marked this conversation as resolved.
Show resolved Hide resolved
returnType = "V",
parameters = listOf("Z"),
oSumAtrIX marked this conversation as resolved.
Show resolved Hide resolved
strings = listOf("use_debug_subscription_settings"),
customFingerprint = { methodDef, _ ->
methodDef.definingClass.endsWith("/RevCatSubscriptionSettingsRepository;")
}
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package app.revanced.patches.vsco.misc.pro.patch

import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.vsco.misc.pro.annotations.ProUnlockCompatibility
import app.revanced.patches.vsco.misc.pro.fingerprints.RevCatSubscriptionFingerprint


@Patch
@Name("pro-unlock")
@Description("Unlock Pro functions.")
@ProUnlockCompatibility
@Version("0.0.1")
class ProUnlockPatch : BytecodePatch(
listOf(RevCatSubscriptionFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
RevCatSubscriptionFingerprint.result?.mutableMethod?.apply {
addInstructions(
0,
"""
# Set isSubscribed param to True
const p1, 0x1
"""
)
} ?: return RevCatSubscriptionFingerprint.toErrorResult()

return PatchResultSuccess()
}
}