refactor(infinityforreddit): UnlockSubscriptionPatch

This commit is contained in:
Pun Butrach
2026-01-12 15:57:16 +07:00
parent 7787268bed
commit 555b6fe3ca
2 changed files with 12 additions and 13 deletions

View File

@@ -1,14 +1,14 @@
package app.revanced.patches.reddit.customclients.infinityforreddit.subscription
import app.revanced.patcher.fingerprint
import app.revanced.patcher.BytecodePatchContextMethodMatching.gettingFirstMutableMethodDeclaratively
import app.revanced.patcher.instructions
import app.revanced.patcher.literal
import app.revanced.patcher.patch.BytecodePatchContext
internal val billingClientOnServiceConnectedFingerprint = fingerprint {
strings("Billing service connected")
}
internal val BytecodePatchContext.billingClientOnServiceConnectedMethod by gettingFirstMutableMethodDeclaratively("Billing service connected")
internal val startSubscriptionActivityFingerprint = fingerprint {
internal val BytecodePatchContext.startSubscriptionActivityMethod by gettingFirstMutableMethodDeclaratively {
instructions(
literal(0x10008000) // Intent start flag only used in the subscription activity
literal(0x10008000)
)
}

View File

@@ -1,12 +1,11 @@
package app.revanced.patches.reddit.customclients.infinityforreddit.subscription
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.patch.creatingBytecodePatch
import app.revanced.patches.reddit.customclients.infinityforreddit.api.spoofClientPatch
import app.revanced.util.returnEarly
@Suppress("unused")
val unlockSubscriptionPatch = bytecodePatch(
name = "Unlock subscription",
@Suppress("unused", "ObjectPropertyName")
val `Unlock subscription` by creatingBytecodePatch(
description = "Unlocks the subscription feature but requires a custom client ID.",
) {
dependsOn(spoofClientPatch)
@@ -19,8 +18,8 @@ val unlockSubscriptionPatch = bytecodePatch(
apply {
setOf(
startSubscriptionActivityFingerprint,
billingClientOnServiceConnectedFingerprint,
).forEach { it.method.returnEarly() }
billingClientOnServiceConnectedMethod,
startSubscriptionActivityMethod,
).forEach { it.returnEarly() }
}
}