Skip to content

Commit

Permalink
fix: TroopFileRename and ChatItemShowQQUin for QQ 8.9.88
Browse files Browse the repository at this point in the history
  • Loading branch information
klxiaoniu committed Nov 6, 2023
1 parent 882f340 commit 05f9da0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
20 changes: 11 additions & 9 deletions app/src/main/java/cc/ioctl/hook/troop/TroopFileRename.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,13 @@ object TroopFileRename : PluginDelayableHook("ketal_TroopFileRename"), View.OnCl
override val isAvailable = requireMinQQVersion(QQVersion.QQ_8_6_0)

override fun startHook(classLoader: ClassLoader) = throwOrTrue {
val builder = if (requireMinQQVersion(QQVersion.QQ_8_9_0)) {
"com.tencent.mobileqq.troop.widget.g"
} else {
"com.tencent.mobileqq.troop.widget.TroopFileItemBuilder"
}.findClass(classLoader)
val builderClzName = if (requireMinQQVersion(QQVersion.QQ_8_9_88)) "h"
else if (requireMinQQVersion(QQVersion.QQ_8_9_0)) "g"
else "TroopFileItemBuilder"
val builder = ("com.tencent.mobileqq.troop.widget.$builderClzName").findClass(classLoader)
builder.declaredMethods.find {
val args = it.parameterTypes
it.returnType == Void.TYPE
&& args[1].equals(View::class.java)
it.returnType == Void.TYPE && args[1].equals(View::class.java)
}?.hookBefore(this) {
val ctx = it.args[0]
val obj = it.args[2] as Array<*>
Expand All @@ -96,8 +94,11 @@ object TroopFileRename : PluginDelayableHook("ketal_TroopFileRename"), View.OnCl
}
}

val clazzName = if (requireMinQQVersion(QQVersion.QQ_8_9_0)) "c" else "TrooFileTextViewMenuBuilder"
val updateRightMenuItem = "Lcom/tencent/mobileqq/troop/widget/$clazzName;->updateRightMenuItem(ILjava/lang/Object;Lcom/tencent/widget/SwipRightMenuBuilder\$SwipRightMenuItem;Landroid/view/View\$OnClickListener;)Landroid/view/View;".method
val clazzName = if (requireMinQQVersion(QQVersion.QQ_8_9_88)) "d"
else if (requireMinQQVersion(QQVersion.QQ_8_9_0)) "c"
else "TrooFileTextViewMenuBuilder"
val updateRightMenuItem =
"Lcom/tencent/mobileqq/troop/widget/$clazzName;->updateRightMenuItem(ILjava/lang/Object;Lcom/tencent/widget/SwipRightMenuBuilder\$SwipRightMenuItem;Landroid/view/View\$OnClickListener;)Landroid/view/View;".method
updateRightMenuItem.hookAfter(this) {
val obj = it.args[1] as Array<*>
val info = TroopFileInfo(obj[1]!!)
Expand Down Expand Up @@ -159,6 +160,7 @@ object TroopFileRename : PluginDelayableHook("ketal_TroopFileRename"), View.OnCl
})
}
setNegativeButton("取消") { _, _ -> }
setCancelable(false)
}.show()
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/io/github/qauxv/util/QQVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,5 @@ private QQVersion() {
public static final long QQ_8_9_80 = 4614;
public static final long QQ_8_9_83 = 4680;
public static final long qq_8_9_85 = 4766;
public static final long QQ_8_9_88_12880 = 4790; // beta
public static final long QQ_8_9_88 = 4852;
}
2 changes: 1 addition & 1 deletion app/src/main/java/me/ketal/hook/ChatItemShowQQUin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ object ChatItemShowQQUin : CommonConfigFunctionHook(), OnBubbleBuilder {

// X2J_APT <- ???Binding <- AIOSenderBubbleTemplate
private val NAME_TAIL_LAYOUT = when {
requireMinQQVersion(QQVersion.QQ_8_9_88_12880) -> "slv"
requireMinQQVersion(QQVersion.QQ_8_9_88) -> "slx"
requireMinQQVersion(QQVersion.qq_8_9_85) -> "sih"
requireMinQQVersion(QQVersion.QQ_8_9_83) -> "shv"
requireMinQQVersion(QQVersion.QQ_8_9_80) -> "sg6"
Expand Down

0 comments on commit 05f9da0

Please sign in to comment.