diff --git a/api/revanced-patches.api b/api/revanced-patches.api index e8eba4ec4..1c47eb4ea 100644 --- a/api/revanced-patches.api +++ b/api/revanced-patches.api @@ -684,6 +684,12 @@ public final class app/revanced/patches/reddit/customclients/baconreader/api/Spo public fun patchClientId (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V } +public final class app/revanced/patches/reddit/customclients/boostforreddit/ads/DisableAdsPatch : app/revanced/patcher/patch/BytecodePatch { + public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/boostforreddit/ads/DisableAdsPatch; + public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V + public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V +} + public final class app/revanced/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/BaseSpoofClientPatch { public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch; public fun patchClientId (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/ads/DisableAdsPatch.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/ads/DisableAdsPatch.kt new file mode 100644 index 000000000..00fc7b829 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/ads/DisableAdsPatch.kt @@ -0,0 +1,23 @@ +package app.revanced.patches.reddit.customclients.boostforreddit.ads + +import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.patch.BytecodePatch +import app.revanced.patches.reddit.customclients.boostforreddit.ads.fingerprints.* +import app.revanced.patcher.extensions.InstructionExtensions.addInstructions +import app.revanced.patcher.patch.annotation.CompatiblePackage +import app.revanced.patcher.patch.annotation.Patch +import app.revanced.util.resultOrThrow + +@Patch( + name = "Disable ads", + compatiblePackages = [CompatiblePackage("com.rubenmayayo.reddit")], +) +@Suppress("unused") +object DisableAdsPatch : BytecodePatch( + setOf(MaxMediationFingerprint, AdmobMediationFingerprint), +) { + override fun execute(context: BytecodeContext) = + arrayOf(MaxMediationFingerprint, AdmobMediationFingerprint).forEach { + it.resultOrThrow().mutableMethod.addInstructions(0, "return-void") + } +} diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/ads/fingerprints/AdmobMediationFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/ads/fingerprints/AdmobMediationFingerprint.kt new file mode 100644 index 000000000..526dc9e96 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/ads/fingerprints/AdmobMediationFingerprint.kt @@ -0,0 +1,7 @@ +package app.revanced.patches.reddit.customclients.boostforreddit.ads.fingerprints + +import app.revanced.patcher.fingerprint.MethodFingerprint + +internal object AdmobMediationFingerprint : MethodFingerprint( + strings = listOf("AdmobMediation: Attempting to initialize SDK") +) diff --git a/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/ads/fingerprints/MaxMediationFingerprint.kt b/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/ads/fingerprints/MaxMediationFingerprint.kt new file mode 100644 index 000000000..38553c0e6 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/ads/fingerprints/MaxMediationFingerprint.kt @@ -0,0 +1,7 @@ +package app.revanced.patches.reddit.customclients.boostforreddit.ads.fingerprints + +import app.revanced.patcher.fingerprint.MethodFingerprint + +internal object MaxMediationFingerprint : MethodFingerprint( + strings = listOf("MaxMediation: Attempting to initialize SDK") +)