Skip to content

Commit

Permalink
fix: ChatItemShowQQUin, RemoveQRLoginAuth, ShowMsgAt for QQ 8.9.70
Browse files Browse the repository at this point in the history
  • Loading branch information
klxiaoniu committed Jul 24, 2023
1 parent a41e7c5 commit c0fd8e7
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
2 changes: 2 additions & 0 deletions app/src/main/java/io/github/qauxv/tlb/QQConfigTable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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会员 我的钱包等)
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/io/github/qauxv/util/QQVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
8 changes: 5 additions & 3 deletions app/src/main/java/me/ketal/hook/ChatItemShowQQUin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<String?> by lazy {
MutableStateFlow(if (isEnabled) "已开启" else "禁用")
Expand Down Expand Up @@ -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<ViewStub>(NAME_TAIL_LAYOUT) ?: return
val stub = rootView.findHostView<ViewStub>(NAME_TAIL_LAYOUT)!!
stub.inflate() as FrameLayout
}
if (!tailLayout.children.map { it.id }.contains(ID_ADD_LAYOUT)) {
Expand Down
9 changes: 8 additions & 1 deletion app/src/main/java/me/ketal/hook/RemoveQRLoginAuth.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/me/ketal/hook/ShowMsgAt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ object ShowMsgAt : CommonSwitchFunctionHook(), OnBubbleBuilder {
override val uiItemLocation = FunctionEntryRouter.Locations.Auxiliary.MESSAGE_CATEGORY
override val extraSearchKeywords: Array<String> = 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()
Expand Down

0 comments on commit c0fd8e7

Please sign in to comment.