Skip to content

Commit

Permalink
fix: DisableLightInteraction on 9.0.8 before
Browse files Browse the repository at this point in the history
  • Loading branch information
HdShare committed Nov 4, 2024
1 parent 1d5d87b commit 92c6ee3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
11 changes: 6 additions & 5 deletions app/src/main/java/cc/ioctl/hook/chat/DisableLightInteraction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

package cc.ioctl.hook.chat

import com.github.kyuubiran.ezxhelper.utils.emptyParam
import com.github.kyuubiran.ezxhelper.utils.hookReturnConstant
import com.github.kyuubiran.ezxhelper.utils.paramCount
import io.github.qauxv.base.annotation.FunctionHookEntry
Expand All @@ -31,11 +30,15 @@ import io.github.qauxv.dsl.FunctionEntryRouter
import io.github.qauxv.hook.CommonSwitchFunctionHook
import io.github.qauxv.util.Initiator
import io.github.qauxv.util.QQVersion
import io.github.qauxv.util.dexkit.DexKit
import io.github.qauxv.util.dexkit.DisableLightInteractionMethod
import io.github.qauxv.util.requireMinQQVersion

@FunctionHookEntry
@UiItemAgentEntry
object DisableLightInteraction : CommonSwitchFunctionHook() {
object DisableLightInteraction : CommonSwitchFunctionHook(
targets = arrayOf(DisableLightInteractionMethod)
) {

override val name = "禁用轻互动"
override val description = "隐藏聊天列表有时出现的表情 (早上好, 戳一戳, 晚安) 点一下发一条消息然后消失"
Expand All @@ -50,9 +53,7 @@ object DisableLightInteraction : CommonSwitchFunctionHook() {
it.paramCount == 1 && it.returnType == java.util.List::class.java
}.hookReturnConstant(emptyList<Any>())
} else {
kLIAConfigManager.declaredMethods.single {
it.emptyParam && it.returnType == java.util.Map::class.java
}.hookReturnConstant(emptyMap<Any, Any>())
DexKit.requireMethodFromCache(DisableLightInteractionMethod).hookReturnConstant(null)
}
return true
}
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/java/io/github/qauxv/util/dexkit/DexKitTarget.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package io.github.qauxv.util.dexkit

import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import cc.ioctl.util.HostInfo
import com.github.kyuubiran.ezxhelper.utils.isAbstract
import com.github.kyuubiran.ezxhelper.utils.isFinal
Expand Down Expand Up @@ -1050,4 +1051,14 @@ data object UnlockTroopNameLimitClass : DexKitTarget.UsingStr() {
override val traitString = arrayOf("[☀-⟿]")
override val declaringClass = "Lcom/tencent/mobileqq/activity/editservice/EditTroopMemberNickService\$EmojiFilter;"
override val filter = DexKitFilter.strInClsName("com/tencent/mobileqq/activity/editservice/EditTroopMemberNickService")
}

data object DisableLightInteractionMethod : DexKitTarget.UsingStr() {
override val findMethod = true
override val traitString = arrayOf("em_bas_shortcut_bar_above_c2c_input_box")
override val declaringClass = "Lcom/tencent/mobileqq/aio/bottombar/c2c/LiteActionBottomBar;"
override val filter = filter@{ it: DexMethodDescriptor ->
val m = kotlin.runCatching { it.getMethodInstance(getHostClassLoader()) }.getOrNull() ?: return@filter false
m.returnType == View::class.java && m.paramCount == 2 && m.parameterTypes[1] == ViewGroup::class.java
}
}

0 comments on commit 92c6ee3

Please sign in to comment.