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 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.literal
import app.revanced.patcher.patch.BytecodePatchContext
internal val billingClientOnServiceConnectedFingerprint = fingerprint { internal val BytecodePatchContext.billingClientOnServiceConnectedMethod by gettingFirstMutableMethodDeclaratively("Billing service connected")
strings("Billing service connected")
}
internal val startSubscriptionActivityFingerprint = fingerprint { internal val BytecodePatchContext.startSubscriptionActivityMethod by gettingFirstMutableMethodDeclaratively {
instructions( 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 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.patches.reddit.customclients.infinityforreddit.api.spoofClientPatch
import app.revanced.util.returnEarly import app.revanced.util.returnEarly
@Suppress("unused") @Suppress("unused", "ObjectPropertyName")
val unlockSubscriptionPatch = bytecodePatch( val `Unlock subscription` by creatingBytecodePatch(
name = "Unlock subscription",
description = "Unlocks the subscription feature but requires a custom client ID.", description = "Unlocks the subscription feature but requires a custom client ID.",
) { ) {
dependsOn(spoofClientPatch) dependsOn(spoofClientPatch)
@ -19,8 +18,8 @@ val unlockSubscriptionPatch = bytecodePatch(
apply { apply {
setOf( setOf(
startSubscriptionActivityFingerprint, billingClientOnServiceConnectedMethod,
billingClientOnServiceConnectedFingerprint, startSubscriptionActivityMethod,
).forEach { it.method.returnEarly() } ).forEach { it.returnEarly() }
} }
} }