Skip to content

Commit

Permalink
fix: DisableFlingToTroopGuild for QQNT
Browse files Browse the repository at this point in the history
  • Loading branch information
klxiaoniu committed Sep 6, 2023
1 parent d154251 commit 05dbff5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "禁用右滑切换群帖子"

Expand All @@ -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 ->
Expand Down
15 changes: 11 additions & 4 deletions app/src/main/java/io/github/qauxv/util/dexkit/DexKitTarget.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

0 comments on commit 05dbff5

Please sign in to comment.