feat(Messenger): Add Hide Facebook button patch (#5057)

This commit is contained in:
Dawid Krajcarz
2025-06-09 20:13:05 +02:00
committed by GitHub
parent 4d2decd99c
commit 9175b23e83
7 changed files with 44 additions and 13 deletions

View File

@ -0,0 +1,10 @@
package app.revanced.patches.messenger.layout
import app.revanced.patcher.fingerprint
internal val isFacebookButtonEnabledFingerprint = fingerprint {
parameters()
returns("Z")
strings("com.facebook.messaging.inbox.tab.plugins.core.tabtoolbarbutton." +
"facebookbutton.facebooktoolbarbutton.FacebookButtonTabButtonImplementation")
}

View File

@ -0,0 +1,16 @@
package app.revanced.patches.messenger.layout
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.util.returnEarly
@Suppress("unused")
val hideFacebookButtonPatch = bytecodePatch(
name = "Hide Facebook button",
description = "Hides the Facebook button in the top toolbar."
) {
compatibleWith("com.facebook.orca")
execute {
isFacebookButtonEnabledFingerprint.method.returnEarly(false)
}
}

View File

@ -6,9 +6,8 @@ import app.revanced.patcher.fingerprint
internal val getMobileConfigBoolFingerprint = fingerprint {
parameters("J")
returns("Z")
opcodes(Opcode.RETURN)
custom { method, classDef ->
method.implementation ?: return@custom false // unsure if this is necessary
opcodes(Opcode.RETURN)
custom { _, classDef ->
classDef.interfaces.contains("Lcom/facebook/mobileconfig/factory/MobileConfigUnsafeContext;")
}
}
}

View File

@ -25,10 +25,10 @@ val removeMetaAIPatch = bytecodePatch(
addInstructions(
returnIndex,
"""
invoke-static { p1, p2, v$returnRegister }, $EXTENSION_CLASS_DESCRIPTOR->overrideConfigBool(JZ)Z
invoke-static { p1, p2, v$returnRegister }, $EXTENSION_CLASS_DESCRIPTOR->overrideBooleanFlag(JZ)Z
move-result v$returnRegister
"""
)
}
}
}
}

View File

@ -2,4 +2,4 @@ package app.revanced.patches.messenger.misc.extension
import app.revanced.patches.shared.misc.extension.sharedExtensionPatch
val sharedExtensionPatch = sharedExtensionPatch("messenger", mainActivityOnCreateHook)
val sharedExtensionPatch = sharedExtensionPatch("messenger", mainActivityOnCreateHook)