fix(Infinity for Reddit - Unlock subscription): Do not crash by patching billing client

This commit is contained in:
oSumAtrIX 2024-02-07 16:16:33 +01:00
parent d7451579ee
commit 7d76e2e43c
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
3 changed files with 12 additions and 18 deletions

View file

@ -5,22 +5,22 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.reddit.customclients.infinityforreddit.api.SpoofClientPatch
import app.revanced.patches.reddit.customclients.infinityforreddit.subscription.fingerprints.BillingClientOnServiceConnected
import app.revanced.patches.reddit.customclients.infinityforreddit.subscription.fingerprints.StartSubscriptionActivityFingerprint
import app.revanced.patches.reddit.customclients.infinityforreddit.subscription.fingerprints.SubscriptionActivityOnCreateFingerprint
import app.revanced.util.returnEarly
@Patch(
name = "Unlock subscription",
description = "Unlocks the subscription feature but requires a custom client ID.",
compatiblePackages = [
CompatiblePackage("ml.docilealligator.infinityforreddit")
CompatiblePackage("ml.docilealligator.infinityforreddit"),
],
dependencies = [SpoofClientPatch::class]
dependencies = [SpoofClientPatch::class],
)
@Suppress("unused")
object UnlockSubscriptionPatch : BytecodePatch(
setOf(StartSubscriptionActivityFingerprint, SubscriptionActivityOnCreateFingerprint)
setOf(StartSubscriptionActivityFingerprint, BillingClientOnServiceConnected),
) {
override fun execute(context: BytecodeContext) =
listOf(StartSubscriptionActivityFingerprint, SubscriptionActivityOnCreateFingerprint).returnEarly()
listOf(StartSubscriptionActivityFingerprint, BillingClientOnServiceConnected).returnEarly()
}

View file

@ -0,0 +1,7 @@
package app.revanced.patches.reddit.customclients.infinityforreddit.subscription.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint
internal object BillingClientOnServiceConnected : MethodFingerprint(
strings = listOf("Billing service connected"),
)

View file

@ -1,13 +0,0 @@
package app.revanced.patches.reddit.customclients.infinityforreddit.subscription.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
internal object SubscriptionActivityOnCreateFingerprint : MethodFingerprint(
returnType = "V",
accessFlags = AccessFlags.PUBLIC.value,
parameters = listOf("Landroid/os/Bundle;"),
customFingerprint = { method, classDef ->
method.name == "onCreate" && classDef.type.endsWith("SubscriptionActivity;")
}
)