From 05dbff574baa865022f81da96ebb7fcd75e388f0 Mon Sep 17 00:00:00 2001 From: klxiaoniu Date: Wed, 6 Sep 2023 13:44:47 +0800 Subject: [PATCH] fix: DisableFlingToTroopGuild for QQNT --- .../ioctl/hook/troop/DisableFlingToTroopGuild.kt | 10 +++++++++- .../io/github/qauxv/util/dexkit/DexKitTarget.kt | 15 +++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/cc/ioctl/hook/troop/DisableFlingToTroopGuild.kt b/app/src/main/java/cc/ioctl/hook/troop/DisableFlingToTroopGuild.kt index 95e82c2f48..ae08d50462 100644 --- a/app/src/main/java/cc/ioctl/hook/troop/DisableFlingToTroopGuild.kt +++ b/app/src/main/java/cc/ioctl/hook/troop/DisableFlingToTroopGuild.kt @@ -21,19 +21,23 @@ package cc.ioctl.hook.troop +import cc.hicore.QApp.QAppUtils import cc.ioctl.util.hookBeforeIfEnabled +import com.github.kyuubiran.ezxhelper.utils.hookReturnConstant import io.github.qauxv.base.annotation.FunctionHookEntry import io.github.qauxv.base.annotation.UiItemAgentEntry import io.github.qauxv.dsl.FunctionEntryRouter import io.github.qauxv.hook.CommonSwitchFunctionHook import io.github.qauxv.util.QQVersion +import io.github.qauxv.util.dexkit.AIODelegate_ISwipeListener import io.github.qauxv.util.dexkit.DexKit import io.github.qauxv.util.dexkit.TroopGuildChatPie_flingRToL import io.github.qauxv.util.requireMinQQVersion +import xyz.nextalone.util.method @FunctionHookEntry @UiItemAgentEntry -object DisableFlingToTroopGuild : CommonSwitchFunctionHook(arrayOf(TroopGuildChatPie_flingRToL)) { +object DisableFlingToTroopGuild : CommonSwitchFunctionHook(arrayOf(TroopGuildChatPie_flingRToL, AIODelegate_ISwipeListener)) { override val name = "禁用右滑切换群帖子" @@ -45,6 +49,10 @@ object DisableFlingToTroopGuild : CommonSwitchFunctionHook(arrayOf(TroopGuildCha override fun initOnce(): Boolean { if (!requireMinQQVersion(QQVersion.QQ_8_9_23)) return false + if (QAppUtils.isQQnt()) { + DexKit.requireClassFromCache(AIODelegate_ISwipeListener).method("b")!!.hookReturnConstant(null) + return true + } // com.tencent.mobileqq.troop.guild.TroopGuildChatPie#flingRToL()V val flingRToL = DexKit.requireMethodFromCache(TroopGuildChatPie_flingRToL) hookBeforeIfEnabled(flingRToL) { param -> diff --git a/app/src/main/java/io/github/qauxv/util/dexkit/DexKitTarget.kt b/app/src/main/java/io/github/qauxv/util/dexkit/DexKitTarget.kt index 657d589302..c878d3987c 100644 --- a/app/src/main/java/io/github/qauxv/util/dexkit/DexKitTarget.kt +++ b/app/src/main/java/io/github/qauxv/util/dexkit/DexKitTarget.kt @@ -770,30 +770,37 @@ data object Multiforward_Avatar_setListener_NT : DexKitTarget.UsingDexkit() { override val filter = DexKitFilter.allowAll } -data object AIOTextElementCtor: DexKitTarget.UsingStr() { +data object AIOTextElementCtor : DexKitTarget.UsingStr() { override val findMethod: Boolean = true; override val declaringClass = "com.tencent.mobileqq.aio.msg.AIOMsgElement.AIOTextElementCtor" override val traitString = arrayOf("textElement") override val filter = DexKitFilter.strInClsName("com/tencent/mobileqq/aio/msg") } -data object AIOPicElementType: DexKitTarget.UsingStr() { +data object AIOPicElementType : DexKitTarget.UsingStr() { override val findMethod: Boolean = false; override val declaringClass = "com.tencent.mobileqq.aio.msg.AIOMsgElementType.PicElement"; override val traitString = arrayOf("PicElement(origPath="); override val filter = DexKitFilter.strInClsName("com/tencent/qqnt/aio/"); } -data object MultiSelectToBottomIntent: DexKitTarget.UsingStr() { +data object MultiSelectToBottomIntent : DexKitTarget.UsingStr() { override val findMethod: Boolean = false; override val declaringClass = "com.tencent.mobileqq.aio.input.multiselect.c.toBottomIntent"; override val traitString = arrayOf("SelectToBottom(dividingLineTop="); override val filter = DexKitFilter.strInClsName("com/tencent/mobileqq/aio/input/multiselect"); } -data object AIOSendMsg: DexKitTarget.UsingStr() { +data object AIOSendMsg : DexKitTarget.UsingStr() { override val findMethod: Boolean = true; override val declaringClass = "com.tencent.mobileqq.aio.input.sendmsg.AIOSendMsgVMDelegate.sendMsg"; override val traitString = arrayOf("[sendMsg] elements is empty"); override val filter = DexKitFilter.strInClsName("com/tencent/mobileqq/aio/input/sendmsg/AIOSendMsgVMDelegate"); } + +data object AIODelegate_ISwipeListener : DexKitTarget.UsingStringVector() { + override val findMethod: Boolean = false + override val declaringClass = "com.tencent.qqnt.aio.activity" + override val traitStringVectors = arrayOf(arrayOf("aio_disappear_type", "close_aio")) + override val filter = DexKitFilter.strInClsName("com/tencent/qqnt/aio/activity") +}