feat(facebook): hide-inbox-ads patch (#1893)

Signed-off-by: badawoll <129878899+badawoll@users.noreply.github.com>
This commit is contained in:
badawoll 2023-04-13 15:24:44 +00:00 committed by oSumAtrIX
parent 43464fd6ff
commit 2cfc9829e1
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
2 changed files with 47 additions and 0 deletions

View file

@ -0,0 +1,18 @@
package app.revanced.patches.messenger.ads.inbox.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
object LoadInboxAdsFingerprint : MethodFingerprint(
returnType = "V",
strings = listOf(
"ads_load_begin",
"inbox_ads_fetch_start"
),
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
customFingerprint = {
it.definingClass == "Lcom/facebook/messaging/business/inboxads/plugins/inboxads/itemsupplier/InboxAdsItemSupplierImplementation;"
}
)

View file

@ -0,0 +1,29 @@
package app.revanced.patches.messenger.ads.inbox.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.*
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.messenger.ads.inbox.fingerprints.LoadInboxAdsFingerprint
@Patch
@Name("hide-inbox-ads")
@Description("Hides ads in inbox.")
@Compatibility([Package("com.facebook.orca")])
@Version("0.0.1")
class HideInboxAdsPatch : BytecodePatch(
listOf(LoadInboxAdsFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
LoadInboxAdsFingerprint.result?.mutableMethod?.apply {
this.replaceInstruction(0, "return-void")
} ?: return LoadInboxAdsFingerprint.toErrorResult()
return PatchResultSuccess()
}
}