From 555b6fe3caca0d33f19e5a17c66433b8bc1bd6a1 Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Mon, 12 Jan 2026 15:57:16 +0700 Subject: [PATCH] refactor(infinityforreddit): UnlockSubscriptionPatch --- .../infinityforreddit/subscription/Fingerprints.kt | 12 ++++++------ .../subscription/UnlockSubscriptionPatch.kt | 13 ++++++------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/Fingerprints.kt index b8999d22c..c133028a6 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/Fingerprints.kt @@ -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) ) } diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/UnlockSubscriptionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/UnlockSubscriptionPatch.kt index 86c228fca..6fc58b566 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/UnlockSubscriptionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/UnlockSubscriptionPatch.kt @@ -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() } } }