From c0fd8e78e0f27de6e049d547cdd147420808efef Mon Sep 17 00:00:00 2001 From: klxiaoniu Date: Mon, 24 Jul 2023 14:33:38 +0800 Subject: [PATCH] fix: ChatItemShowQQUin, RemoveQRLoginAuth, ShowMsgAt for QQ 8.9.70 --- app/src/main/java/io/github/qauxv/tlb/QQConfigTable.kt | 2 ++ app/src/main/java/io/github/qauxv/util/QQVersion.java | 1 + app/src/main/java/me/ketal/hook/ChatItemShowQQUin.kt | 8 +++++--- app/src/main/java/me/ketal/hook/RemoveQRLoginAuth.kt | 9 ++++++++- app/src/main/java/me/ketal/hook/ShowMsgAt.kt | 4 +++- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/github/qauxv/tlb/QQConfigTable.kt b/app/src/main/java/io/github/qauxv/tlb/QQConfigTable.kt index d8a0046ff3..0bdff43610 100644 --- a/app/src/main/java/io/github/qauxv/tlb/QQConfigTable.kt +++ b/app/src/main/java/io/github/qauxv/tlb/QQConfigTable.kt @@ -60,6 +60,7 @@ import io.github.qauxv.util.QQVersion.QQ_8_9_28 import io.github.qauxv.util.QQVersion.QQ_8_9_3 import io.github.qauxv.util.QQVersion.QQ_8_9_63 import io.github.qauxv.util.QQVersion.QQ_8_9_68 +import io.github.qauxv.util.QQVersion.QQ_8_9_70 import io.github.qauxv.util.QQVersion.QQ_8_9_8 import me.ketal.hook.SortAtPanel import xyz.nextalone.hook.ChatWordsCount @@ -100,6 +101,7 @@ class QQConfigTable : ConfigTableInterface { // NT begin QQ_8_9_63 to "nxj", QQ_8_9_68 to "nyb", + QQ_8_9_70 to "nyn" ), //中间部分(QQ会员 我的钱包等) diff --git a/app/src/main/java/io/github/qauxv/util/QQVersion.java b/app/src/main/java/io/github/qauxv/util/QQVersion.java index 5b114c294b..e1b68ec9e5 100644 --- a/app/src/main/java/io/github/qauxv/util/QQVersion.java +++ b/app/src/main/java/io/github/qauxv/util/QQVersion.java @@ -97,4 +97,5 @@ private QQVersion() { // The first NT version public static final long QQ_8_9_63 = 4194; public static final long QQ_8_9_68 = 4264; + public static final long QQ_8_9_70 = 4330; } diff --git a/app/src/main/java/me/ketal/hook/ChatItemShowQQUin.kt b/app/src/main/java/me/ketal/hook/ChatItemShowQQUin.kt index 5d07e1ca69..8fcf01d15d 100644 --- a/app/src/main/java/me/ketal/hook/ChatItemShowQQUin.kt +++ b/app/src/main/java/me/ketal/hook/ChatItemShowQQUin.kt @@ -93,7 +93,9 @@ object ChatItemShowQQUin : CommonConfigFunctionHook(), OnBubbleBuilder { // For NT private const val ID_ADD_LAYOUT = 0x114515 private const val ID_ADD_TEXTVIEW = 0x114516 - private val NAME_TAIL_LAYOUT = if (requireMinQQVersion(QQVersion.QQ_8_9_68)) "s3o" else "rzs" + private val NAME_TAIL_LAYOUT = if (requireMinQQVersion(QQVersion.QQ_8_9_70)) "s55" + else if (requireMinQQVersion(QQVersion.QQ_8_9_68)) "s3o" + else "rzs" override val valueState: MutableStateFlow by lazy { MutableStateFlow(if (isEnabled) "已开启" else "禁用") @@ -336,9 +338,9 @@ object ChatItemShowQQUin : CommonConfigFunctionHook(), OnBubbleBuilder { if (!isEnabled && !isFlashPicTagNeedShow) return val tailLayout = try { - rootView.findHostView(NAME_TAIL_LAYOUT) ?: throw Exception("TailLayout not found") + rootView.findHostView(NAME_TAIL_LAYOUT) ?: return } catch (_: Exception) { - val stub = rootView.findHostView(NAME_TAIL_LAYOUT) ?: return + val stub = rootView.findHostView(NAME_TAIL_LAYOUT)!! stub.inflate() as FrameLayout } if (!tailLayout.children.map { it.id }.contains(ID_ADD_LAYOUT)) { diff --git a/app/src/main/java/me/ketal/hook/RemoveQRLoginAuth.kt b/app/src/main/java/me/ketal/hook/RemoveQRLoginAuth.kt index 94d6cb1c0a..39e81f19b8 100644 --- a/app/src/main/java/me/ketal/hook/RemoveQRLoginAuth.kt +++ b/app/src/main/java/me/ketal/hook/RemoveQRLoginAuth.kt @@ -30,6 +30,7 @@ import io.github.qauxv.hook.CommonSwitchFunctionHook import io.github.qauxv.util.Initiator import io.github.qauxv.util.QQVersion import io.github.qauxv.util.QQVersion.QQ_8_9_0 +import io.github.qauxv.util.QQVersion.QQ_8_9_70 import io.github.qauxv.util.requireMinQQVersion import xyz.nextalone.util.hookBefore import xyz.nextalone.util.throwOrTrue @@ -43,7 +44,13 @@ object RemoveQRLoginAuth : CommonSwitchFunctionHook() { override val isAvailable: Boolean get() = requireMinQQVersion(QQVersion.QQ_8_5_0) override fun initOnce() = throwOrTrue { - val clazz = if (requireMinQQVersion(QQ_8_9_0)) "com/tencent/open/agent/QrAgentLoginManager\$a" else "com/tencent/open/agent/QrAgentLoginManager\$2" + val clazz = if (requireMinQQVersion(QQ_8_9_70)) { + "com/tencent/open/agent/QrAgentLoginManager" + } else if (requireMinQQVersion(QQ_8_9_0)) { + "com/tencent/open/agent/QrAgentLoginManager\$a" + } else { + "com/tencent/open/agent/QrAgentLoginManager\$2" + } Initiator.loadClass(clazz).declaredMethods .findMethod { returnType == Void.TYPE && parameterTypes.isNotEmpty() && parameterTypes[0] == Boolean::class.java diff --git a/app/src/main/java/me/ketal/hook/ShowMsgAt.kt b/app/src/main/java/me/ketal/hook/ShowMsgAt.kt index 1d56cd9762..22f3eec4c3 100644 --- a/app/src/main/java/me/ketal/hook/ShowMsgAt.kt +++ b/app/src/main/java/me/ketal/hook/ShowMsgAt.kt @@ -66,7 +66,9 @@ object ShowMsgAt : CommonSwitchFunctionHook(), OnBubbleBuilder { override val uiItemLocation = FunctionEntryRouter.Locations.Auxiliary.MESSAGE_CATEGORY override val extraSearchKeywords: Array = arrayOf("@", "艾特") - private val NAME_TEXTVIEW = if (requireMinQQVersion(QQVersion.QQ_8_9_68)) "ewl" else "ewk" + private val NAME_TEXTVIEW = if (requireMinQQVersion(QQVersion.QQ_8_9_70)) "ex1" + else if (requireMinQQVersion(QQVersion.QQ_8_9_68)) "ewl" + else "ewk" override fun initOnce(): Boolean { return !isTim() && BaseBubbleBuilderHook.initialize()