From bf19af99cb522f9027a4b3ae42d6258ac71758e5 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Fri, 2 Feb 2024 00:10:00 +0100 Subject: [PATCH] fix(Infinity for Reddit - Unlock subscription): Restore functionality on v7.0.0 --- .../subscription/UnlockSubscriptionPatch.kt | 6 ++++-- .../SubscriptionActivityOnCreateFingerprint.kt | 13 +++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/fingerprints/SubscriptionActivityOnCreateFingerprint.kt diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/UnlockSubscriptionPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/UnlockSubscriptionPatch.kt index 9de0f38356..a603602028 100644 --- a/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/UnlockSubscriptionPatch.kt +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/UnlockSubscriptionPatch.kt @@ -6,6 +6,7 @@ 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.StartSubscriptionActivityFingerprint +import app.revanced.patches.reddit.customclients.infinityforreddit.subscription.fingerprints.SubscriptionActivityOnCreateFingerprint import app.revanced.util.returnEarly @Patch( @@ -18,7 +19,8 @@ import app.revanced.util.returnEarly ) @Suppress("unused") object UnlockSubscriptionPatch : BytecodePatch( - setOf(StartSubscriptionActivityFingerprint) + setOf(StartSubscriptionActivityFingerprint, SubscriptionActivityOnCreateFingerprint) ) { - override fun execute(context: BytecodeContext) = listOf(StartSubscriptionActivityFingerprint).returnEarly() + override fun execute(context: BytecodeContext) = + listOf(StartSubscriptionActivityFingerprint, SubscriptionActivityOnCreateFingerprint).returnEarly() } diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/fingerprints/SubscriptionActivityOnCreateFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/fingerprints/SubscriptionActivityOnCreateFingerprint.kt new file mode 100644 index 0000000000..dd5f1710de --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/fingerprints/SubscriptionActivityOnCreateFingerprint.kt @@ -0,0 +1,13 @@ +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;") + } +)