From 840b29e9891243a4ccabb6ade5ad6ac92984efc2 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sat, 2 Dec 2023 17:27:12 +0100 Subject: [PATCH] feat(Infinity for Reddit): Add `Unlock subscription` patch --- .../subscription/UnlockSubscriptionPatch.kt | 24 +++++++++++++++++++ .../StartSubscriptionActivityFingerprint.kt | 7 ++++++ 2 files changed, 31 insertions(+) create mode 100644 src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/UnlockSubscriptionPatch.kt create mode 100644 src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/fingerprints/StartSubscriptionActivityFingerprint.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 new file mode 100644 index 00000000..725a82f5 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/UnlockSubscriptionPatch.kt @@ -0,0 +1,24 @@ +package app.revanced.patches.reddit.customclients.infinityforreddit.subscription + +import app.revanced.patcher.data.BytecodeContext +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.StartSubscriptionActivityFingerprint +import app.revanced.util.Utils.returnEarly + +@Patch( + name = "Unlock subscription", + description = "Unlocks the subscription feature but requires a custom client ID.", + dependencies = [SpoofClientPatch::class], + compatiblePackages = [ + CompatiblePackage("ml.docilealligator.infinityforreddit") + ] +) +@Suppress("unused") +object UnlockSubscriptionPatch : BytecodePatch( + setOf(StartSubscriptionActivityFingerprint) +) { + override fun execute(context: BytecodeContext) = listOf(StartSubscriptionActivityFingerprint).returnEarly() +} diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/fingerprints/StartSubscriptionActivityFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/fingerprints/StartSubscriptionActivityFingerprint.kt new file mode 100644 index 00000000..c8adebfe --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/fingerprints/StartSubscriptionActivityFingerprint.kt @@ -0,0 +1,7 @@ +package app.revanced.patches.reddit.customclients.infinityforreddit.subscription.fingerprints + +import app.revanced.util.patch.LiteralValueFingerprint + +internal object StartSubscriptionActivityFingerprint : LiteralValueFingerprint( + literalSupplier = { 0x10008000 } // Intent start flag only used in the subscription activity +) \ No newline at end of file