feat(Threads): Hide Ads (#5064)

This commit is contained in:
scruz 2025-05-29 12:44:24 +05:30 committed by GitHub
parent 0b9001613d
commit 3c4cecb966
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 41 additions and 30 deletions

View File

@ -296,6 +296,10 @@ public final class app/revanced/patches/messenger/navbar/RemoveMetaAITabPatchKt
public static final fun getRemoveMetaAITabPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/meta/ads/HideAdsPatchKt {
public static final fun getHideAdsPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/mifitness/misc/locale/ForceEnglishLocalePatchKt {
public static final fun getForceEnglishLocalePatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}

View File

@ -1,23 +1,9 @@
package app.revanced.patches.instagram.ads
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.bytecodePatch
@Deprecated("Patch was moved to different package: app.revanced.patches.meta.ads.hideAdsPatch")
@Suppress("unused")
val hideAdsPatch = bytecodePatch(
name = "Hide ads",
description = "Hides ads in stories, discover, profile, etc. " +
"An ad can still appear once when refreshing the home feed.",
) {
compatibleWith("com.instagram.android")
execute {
adInjectorFingerprint.method.addInstructions(
0,
"""
const/4 v0, 0x0
return v0
""",
)
}
val hideAdsPatch = bytecodePatch {
dependsOn(app.revanced.patches.meta.ads.hideAdsPatch)
}

View File

@ -1,13 +1,13 @@
package app.revanced.patches.instagram.ads
import app.revanced.patcher.fingerprint
import com.android.tools.smali.dexlib2.AccessFlags
internal val adInjectorFingerprint = fingerprint {
accessFlags(AccessFlags.PRIVATE)
returns("Z")
parameters("L", "L")
strings(
"SponsoredContentController.insertItem",
)
}
package app.revanced.patches.meta.ads
import app.revanced.patcher.fingerprint
import com.android.tools.smali.dexlib2.AccessFlags
internal val adInjectorFingerprint = fingerprint {
accessFlags(AccessFlags.PRIVATE)
returns("Z")
parameters("L", "L")
strings(
"SponsoredContentController.insertItem",
)
}

View File

@ -0,0 +1,21 @@
package app.revanced.patches.meta.ads
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.util.returnEarly
@Suppress("unused")
val hideAdsPatch = bytecodePatch(
name = "Hide ads",
) {
/**
* Patch is identical for both Instagram and Threads app.
*/
compatibleWith(
"com.instagram.android",
"com.instagram.barcelona",
)
execute {
adInjectorFingerprint.method.returnEarly(false)
}
}