Skip to content

Commit

Permalink
feat(Boost for Reddit): Add Disable ads patch (#3474)
Browse files Browse the repository at this point in the history
Co-authored-by: oSumAtrIX <[email protected]>
  • Loading branch information
LilithSilver and oSumAtrIX authored Jul 31, 2024
1 parent fd22033 commit b292c20
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
6 changes: 6 additions & 0 deletions api/revanced-patches.api
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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")
}
}
Original file line number Diff line number Diff line change
@@ -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")
)
Original file line number Diff line number Diff line change
@@ -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")
)

0 comments on commit b292c20

Please sign in to comment.