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")
|
@SuppressWarnings("unused")
|
||||||
public class RemoveMetaAIPatch {
|
public class RemoveMetaAIPatch {
|
||||||
public static boolean overrideConfigBool(long id, boolean value) {
|
public static boolean overrideBooleanFlag(long id, boolean value) {
|
||||||
// It seems like all configs starting with 363219 are related to Meta AI.
|
// This catches all flag IDs related to Meta AI.
|
||||||
// A list of specific ones that need disabling would probably be better,
|
// The IDs change slightly with every update,
|
||||||
// but these config numbers seem to change slightly with each update.
|
// so to work around this, IDs from different versions were compared
|
||||||
// These first 6 digits don't though.
|
// to find what they have in common, which turned out to be those first bits.
|
||||||
if (Long.toString(id).startsWith("363219"))
|
// TODO: Find the specific flags that we care about and patch the code they control instead.
|
||||||
|
if ((id & 0x7FFFFFC000000000L) == 0x810A8000000000L) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return value;
|
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 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 final class app/revanced/patches/messenger/metaai/RemoveMetaAIPatchKt {
|
||||||
public static final fun getRemoveMetaAIPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
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)
|
||||||
|
}
|
||||||
|
}
|
@ -7,8 +7,7 @@ internal val getMobileConfigBoolFingerprint = fingerprint {
|
|||||||
parameters("J")
|
parameters("J")
|
||||||
returns("Z")
|
returns("Z")
|
||||||
opcodes(Opcode.RETURN)
|
opcodes(Opcode.RETURN)
|
||||||
custom { method, classDef ->
|
custom { _, classDef ->
|
||||||
method.implementation ?: return@custom false // unsure if this is necessary
|
|
||||||
classDef.interfaces.contains("Lcom/facebook/mobileconfig/factory/MobileConfigUnsafeContext;")
|
classDef.interfaces.contains("Lcom/facebook/mobileconfig/factory/MobileConfigUnsafeContext;")
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -25,7 +25,7 @@ val removeMetaAIPatch = bytecodePatch(
|
|||||||
addInstructions(
|
addInstructions(
|
||||||
returnIndex,
|
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
|
move-result v$returnRegister
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user