Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ChatInputHint on TIM_NT 4.0.98 #1311

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions app/src/main/java/xyz/nextalone/hook/ChatInputHint.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ import io.github.qauxv.hook.CommonConfigFunctionHook
import io.github.qauxv.ui.CommonContextWrapper
import io.github.qauxv.util.Initiator
import io.github.qauxv.util.QQVersion
import io.github.qauxv.util.TIMVersion
import io.github.qauxv.util.Toasts
import io.github.qauxv.util.dexkit.AIO_InputRootInit_QQNT
import io.github.qauxv.util.dexkit.DexKit
import io.github.qauxv.util.dexkit.NBaseChatPie_init
import io.github.qauxv.util.requireMinQQVersion
import io.github.qauxv.util.requireMinTimVersion
import kotlinx.coroutines.flow.MutableStateFlow
import xyz.nextalone.util.findHostView
import xyz.nextalone.util.hookAfter
Expand All @@ -63,6 +65,25 @@ object ChatInputHint : CommonConfigFunctionHook("na_chat_input_hint", arrayOf(NB
private const val strCfg = "na_chat_input_hint_str"

override fun initOnce(): Boolean = throwOrTrue {
if (requireMinTimVersion(TIMVersion.TIM_4_0_98)) {
// 7f116adf -> 说点什么...
// Lcom/tencent/tim/aio/inputbar/simpleui/a;->v()V
// Lcom/tencent/tim/aio/inputbar/simpleui/TimAIOInputSimpleUIVBDelegate;->B()V
"Lcom/tencent/tim/aio/inputbar/simpleui/a;->v()V".method.hookAfter(this) {
it.thisObject.javaClass.declaredFields.single { it.type == EditText::class.java }.apply {
isAccessible = true
val et = get(it.thisObject) as EditText
et.hint = getValue()
}
}
"Lcom/tencent/tim/aio/inputbar/simpleui/TimAIOInputSimpleUIVBDelegate;->B()V".method.hookAfter(this) {
it.thisObject.javaClass.declaredFields.single { it.type == EditText::class.java }.apply {
isAccessible = true
val et = get(it.thisObject) as EditText
et.hint = getValue()
}
}
}
if (requireMinQQVersion(QQVersion.QQ_8_9_63_BETA_11345)) {
// 私聊 && QQ9.0.35版本后的群聊
DexKit.requireMethodFromCache(AIO_InputRootInit_QQNT).hookAfter(this) {
Expand Down
Loading