feat(Boost for Reddit): Add Disable ads patch (#3474)

Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
LilithSilver 2024-07-31 10:53:44 -07:00 committed by GitHub
parent fd220337f4
commit b292c200bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 43 additions and 0 deletions

View file

@ -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

View file

@ -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")
}
}

View file

@ -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")
)

View file

@ -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")
)