diff --git a/api/revanced-patches.api b/api/revanced-patches.api index 79cdad292..ee5fa6ff1 100644 --- a/api/revanced-patches.api +++ b/api/revanced-patches.api @@ -277,20 +277,26 @@ public final class app/revanced/patches/memegenerator/misc/pro/UnlockProVersionP public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V } -public final class app/revanced/patches/messenger/ads/inbox/patch/HideInboxAdsPatch : app/revanced/patcher/patch/BytecodePatch { - public static final field INSTANCE Lapp/revanced/patches/messenger/ads/inbox/patch/HideInboxAdsPatch; +public final class app/revanced/patches/messenger/inbox/HideInboxAdsPatch : app/revanced/patcher/patch/BytecodePatch { + public static final field INSTANCE Lapp/revanced/patches/messenger/inbox/HideInboxAdsPatch; public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V } -public final class app/revanced/patches/messenger/inputfield/patch/DisableSwitchingEmojiToStickerPatch : app/revanced/patcher/patch/BytecodePatch { - public static final field INSTANCE Lapp/revanced/patches/messenger/inputfield/patch/DisableSwitchingEmojiToStickerPatch; +public final class app/revanced/patches/messenger/inbox/HideInboxSubtabsPatch : app/revanced/patcher/patch/BytecodePatch { + public static final field INSTANCE Lapp/revanced/patches/messenger/inbox/HideInboxSubtabsPatch; public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V } -public final class app/revanced/patches/messenger/inputfield/patch/DisableTypingIndicatorPatch : app/revanced/patcher/patch/BytecodePatch { - public static final field INSTANCE Lapp/revanced/patches/messenger/inputfield/patch/DisableTypingIndicatorPatch; +public final class app/revanced/patches/messenger/inputfield/DisableSwitchingEmojiToStickerPatch : app/revanced/patcher/patch/BytecodePatch { + public static final field INSTANCE Lapp/revanced/patches/messenger/inputfield/DisableSwitchingEmojiToStickerPatch; + public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V + public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V +} + +public final class app/revanced/patches/messenger/inputfield/DisableTypingIndicatorPatch : app/revanced/patcher/patch/BytecodePatch { + public static final field INSTANCE Lapp/revanced/patches/messenger/inputfield/DisableTypingIndicatorPatch; public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V } diff --git a/src/main/kotlin/app/revanced/patches/messenger/ads/inbox/patch/HideInboxAdsPatch.kt b/src/main/kotlin/app/revanced/patches/messenger/inbox/HideInboxAdsPatch.kt similarity index 81% rename from src/main/kotlin/app/revanced/patches/messenger/ads/inbox/patch/HideInboxAdsPatch.kt rename to src/main/kotlin/app/revanced/patches/messenger/inbox/HideInboxAdsPatch.kt index c512ca980..3ce2f74b1 100644 --- a/src/main/kotlin/app/revanced/patches/messenger/ads/inbox/patch/HideInboxAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/messenger/inbox/HideInboxAdsPatch.kt @@ -1,21 +1,21 @@ -package app.revanced.patches.messenger.ads.inbox.patch +package app.revanced.patches.messenger.inbox -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch -import app.revanced.patches.messenger.ads.inbox.fingerprints.LoadInboxAdsFingerprint +import app.revanced.patches.messenger.inbox.fingerprints.LoadInboxAdsFingerprint +import app.revanced.util.exception @Patch( name = "Hide inbox ads", description = "Hides ads in inbox.", - compatiblePackages = [CompatiblePackage("com.facebook.orca")] + compatiblePackages = [CompatiblePackage("com.facebook.orca")], ) @Suppress("unused") object HideInboxAdsPatch : BytecodePatch( - setOf(LoadInboxAdsFingerprint) + setOf(LoadInboxAdsFingerprint), ) { override fun execute(context: BytecodeContext) { LoadInboxAdsFingerprint.result?.mutableMethod?.apply { @@ -23,4 +23,3 @@ object HideInboxAdsPatch : BytecodePatch( } ?: throw LoadInboxAdsFingerprint.exception } } - diff --git a/src/main/kotlin/app/revanced/patches/messenger/inbox/HideInboxSubtabsPatch.kt b/src/main/kotlin/app/revanced/patches/messenger/inbox/HideInboxSubtabsPatch.kt new file mode 100644 index 000000000..f9fa2846e --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/messenger/inbox/HideInboxSubtabsPatch.kt @@ -0,0 +1,24 @@ +package app.revanced.patches.messenger.inbox + +import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction +import app.revanced.patcher.patch.BytecodePatch +import app.revanced.patcher.patch.annotation.CompatiblePackage +import app.revanced.patcher.patch.annotation.Patch +import app.revanced.patches.messenger.inbox.fingerprints.CreateInboxSubTabsFingerprint +import app.revanced.util.exception + +@Patch( + name = "Hide inbox subtabs", + description = "Hides Home and Channels tabs between active now tray and chats.", + compatiblePackages = [CompatiblePackage("com.facebook.orca")], +) +@Suppress("unused") +object HideInboxSubtabsPatch : BytecodePatch( + setOf(CreateInboxSubTabsFingerprint), +) { + // Set InboxSubtabsItemSupplierImplementation boolean attribute to false. + override fun execute(context: BytecodeContext) = CreateInboxSubTabsFingerprint.result?.mutableMethod + ?.replaceInstruction(2, "const/4 v0, 0x0") + ?: throw CreateInboxSubTabsFingerprint.exception +} diff --git a/src/main/kotlin/app/revanced/patches/messenger/inbox/fingerprints/CreateInboxSubTabsFingerprint.kt b/src/main/kotlin/app/revanced/patches/messenger/inbox/fingerprints/CreateInboxSubTabsFingerprint.kt new file mode 100644 index 000000000..ebed20e80 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/messenger/inbox/fingerprints/CreateInboxSubTabsFingerprint.kt @@ -0,0 +1,23 @@ +package app.revanced.patches.messenger.inbox.fingerprints + +import app.revanced.patcher.extensions.or +import app.revanced.patcher.fingerprint.MethodFingerprint +import com.android.tools.smali.dexlib2.AccessFlags +import com.android.tools.smali.dexlib2.Opcode +import com.android.tools.smali.dexlib2.iface.value.StringEncodedValue + +internal object CreateInboxSubTabsFingerprint : MethodFingerprint( + returnType = "V", + accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, + opcodes = listOf( + Opcode.CONST_4, + Opcode.INVOKE_VIRTUAL, + Opcode.RETURN_VOID, + ), + customFingerprint = { methodDef, classDef -> + methodDef.name == "run" && classDef.fields.any any@{ field -> + if (field.name != "__redex_internal_original_name") return@any false + (field.initialValue as? StringEncodedValue)?.value == "InboxSubtabsItemSupplierImplementation\$onSubscribe\$1" + } + }, +) diff --git a/src/main/kotlin/app/revanced/patches/messenger/ads/inbox/fingerprints/LoadInboxAdsFingerprint.kt b/src/main/kotlin/app/revanced/patches/messenger/inbox/fingerprints/LoadInboxAdsFingerprint.kt similarity index 84% rename from src/main/kotlin/app/revanced/patches/messenger/ads/inbox/fingerprints/LoadInboxAdsFingerprint.kt rename to src/main/kotlin/app/revanced/patches/messenger/inbox/fingerprints/LoadInboxAdsFingerprint.kt index 9c45dc97a..b94c5e618 100644 --- a/src/main/kotlin/app/revanced/patches/messenger/ads/inbox/fingerprints/LoadInboxAdsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/messenger/inbox/fingerprints/LoadInboxAdsFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.messenger.ads.inbox.fingerprints +package app.revanced.patches.messenger.inbox.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.MethodFingerprint @@ -8,11 +8,10 @@ internal object LoadInboxAdsFingerprint : MethodFingerprint( returnType = "V", strings = listOf( "ads_load_begin", - "inbox_ads_fetch_start" + "inbox_ads_fetch_start", ), accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC, customFingerprint = { methodDef, _ -> methodDef.definingClass == "Lcom/facebook/messaging/business/inboxads/plugins/inboxads/itemsupplier/InboxAdsItemSupplierImplementation;" - } + }, ) - diff --git a/src/main/kotlin/app/revanced/patches/messenger/inputfield/patch/DisableSwitchingEmojiToStickerPatch.kt b/src/main/kotlin/app/revanced/patches/messenger/inputfield/DisableSwitchingEmojiToStickerPatch.kt similarity index 92% rename from src/main/kotlin/app/revanced/patches/messenger/inputfield/patch/DisableSwitchingEmojiToStickerPatch.kt rename to src/main/kotlin/app/revanced/patches/messenger/inputfield/DisableSwitchingEmojiToStickerPatch.kt index 19e445fda..5da83e876 100644 --- a/src/main/kotlin/app/revanced/patches/messenger/inputfield/patch/DisableSwitchingEmojiToStickerPatch.kt +++ b/src/main/kotlin/app/revanced/patches/messenger/inputfield/DisableSwitchingEmojiToStickerPatch.kt @@ -1,6 +1,5 @@ -package app.revanced.patches.messenger.inputfield.patch +package app.revanced.patches.messenger.inputfield -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction @@ -8,16 +7,17 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.messenger.inputfield.fingerprints.SwitchMessangeInputEmojiButtonFingerprint +import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Patch( name = "Disable switching emoji to sticker", description = "Disables switching from emoji to sticker search mode in message input field.", - compatiblePackages = [CompatiblePackage("com.facebook.orca")] + compatiblePackages = [CompatiblePackage("com.facebook.orca")], ) @Suppress("unused") object DisableSwitchingEmojiToStickerPatch : BytecodePatch( - setOf(SwitchMessangeInputEmojiButtonFingerprint) + setOf(SwitchMessangeInputEmojiButtonFingerprint), ) { override fun execute(context: BytecodeContext) { SwitchMessangeInputEmojiButtonFingerprint.result?.let { @@ -28,7 +28,7 @@ object DisableSwitchingEmojiToStickerPatch : BytecodePatch( replaceInstruction( setStringIndex, - "const-string v$targetRegister, \"expression\"" + "const-string v$targetRegister, \"expression\"", ) } } ?: throw SwitchMessangeInputEmojiButtonFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/messenger/inputfield/patch/DisableTypingIndicatorPatch.kt b/src/main/kotlin/app/revanced/patches/messenger/inputfield/DisableTypingIndicatorPatch.kt similarity index 89% rename from src/main/kotlin/app/revanced/patches/messenger/inputfield/patch/DisableTypingIndicatorPatch.kt rename to src/main/kotlin/app/revanced/patches/messenger/inputfield/DisableTypingIndicatorPatch.kt index 5bdbb50c1..85c744fab 100644 --- a/src/main/kotlin/app/revanced/patches/messenger/inputfield/patch/DisableTypingIndicatorPatch.kt +++ b/src/main/kotlin/app/revanced/patches/messenger/inputfield/DisableTypingIndicatorPatch.kt @@ -1,22 +1,22 @@ -package app.revanced.patches.messenger.inputfield.patch +package app.revanced.patches.messenger.inputfield -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.messenger.inputfield.fingerprints.SendTypingIndicatorFingerprint +import app.revanced.util.exception @Patch( name = "Disable typing indicator", description = "Disables the indicator while typing a message.", - compatiblePackages = [CompatiblePackage("com.facebook.orca")] + compatiblePackages = [CompatiblePackage("com.facebook.orca")], ) @Suppress("unused") object DisableTypingIndicatorPatch : BytecodePatch( - setOf(SendTypingIndicatorFingerprint) -){ + setOf(SendTypingIndicatorFingerprint), +) { override fun execute(context: BytecodeContext) { SendTypingIndicatorFingerprint.result?.mutableMethod?.replaceInstruction(0, "return-void") ?: throw SendTypingIndicatorFingerprint.exception