feat(Messenger): Add Hide Facebook button
patch (#5057)
This commit is contained in:
@ -2,13 +2,15 @@ package app.revanced.extension.messenger.metaai;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class RemoveMetaAIPatch {
|
||||
public static boolean overrideConfigBool(long id, boolean value) {
|
||||
// It seems like all configs starting with 363219 are related to Meta AI.
|
||||
// A list of specific ones that need disabling would probably be better,
|
||||
// but these config numbers seem to change slightly with each update.
|
||||
// These first 6 digits don't though.
|
||||
if (Long.toString(id).startsWith("363219"))
|
||||
public static boolean overrideBooleanFlag(long id, boolean value) {
|
||||
// This catches all flag IDs related to Meta AI.
|
||||
// The IDs change slightly with every update,
|
||||
// so to work around this, IDs from different versions were compared
|
||||
// to find what they have in common, which turned out to be those first bits.
|
||||
// TODO: Find the specific flags that we care about and patch the code they control instead.
|
||||
if ((id & 0x7FFFFFC000000000L) == 0x810A8000000000L) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@ -292,6 +292,10 @@ public final class app/revanced/patches/messenger/inputfield/DisableTypingIndica
|
||||
public static final fun getDisableTypingIndicatorPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/messenger/layout/HideFacebookButtonPatchKt {
|
||||
public static final fun getHideFacebookButtonPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/messenger/metaai/RemoveMetaAIPatchKt {
|
||||
public static final fun getRemoveMetaAIPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
@ -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")
|
||||
}
|
@ -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)
|
||||
}
|
||||
}
|
@ -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;")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user