Skip to content

Commit

Permalink
fix: HandleClickBotMsgSend not handle click links
Browse files Browse the repository at this point in the history
Closes #1179
  • Loading branch information
HdShare committed Sep 13, 2024
1 parent 8d73e78 commit 563d5a8
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions app/src/main/java/me/hd/hook/HandleClickBotMsgSend.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ import io.github.qauxv.dsl.FunctionEntryRouter
import io.github.qauxv.hook.CommonSwitchFunctionHook
import io.github.qauxv.ui.CommonContextWrapper
import io.github.qauxv.util.QQVersion
import io.github.qauxv.util.hostInfo
import io.github.qauxv.util.requireMinQQVersion
import io.github.qauxv.util.xpcompat.XposedBridge
import xyz.nextalone.util.get
import xyz.nextalone.util.method

@FunctionHookEntry
Expand All @@ -50,15 +52,41 @@ object HandleClickBotMsgSend : CommonSwitchFunctionHook() {
param.result = null
val activity = ContextUtils.getCurrentActivity()
val context = CommonContextWrapper.createMaterialDesignContext(activity)
val message = param.thisObject.findFieldObjectAs<String> { type == String::class.java }
MaterialDialog(context).show {
title(text = "是否发送以下内容")
message(text = message)
positiveButton(text = "") {

val (btnModelName, prototypeName) = when (hostInfo.versionCode) {
QQVersion.QQ_9_1_0 -> Pair("m", "d")//9.0.70~9.1.0
QQVersion.QQ_9_0_60 -> Pair("j", "d")//9.0.60~9.0.68
QQVersion.QQ_9_0_35 -> Pair("n", "d")//9.0.0~9.0.50
else -> Pair("", "")
}
if (btnModelName != "" && prototypeName != "") {
val btnModel = param.thisObject.get(btnModelName)
val prototype = btnModel.get(prototypeName)
val label = prototype.get("label") as String
val type = prototype.get("type") as Int
if (type == 2) {
MaterialDialog(context).show {
title(text = "是否发送内容")
message(text = label)
positiveButton(text = "") {
XposedBridge.invokeOriginalMethod(param.method, param.thisObject, param.args)
}
negativeButton(text = "")
}
} else {
XposedBridge.invokeOriginalMethod(param.method, param.thisObject, param.args)
}
negativeButton(text = "")
} else {
MaterialDialog(context).show {
title(text = "是否发送内容或打开链接")
message(text = param.thisObject.findFieldObjectAs<String> { type == String::class.java })
positiveButton(text = "") {
XposedBridge.invokeOriginalMethod(param.method, param.thisObject, param.args)
}
negativeButton(text = "")
}
}

}
return true
}
Expand Down

0 comments on commit 563d5a8

Please sign in to comment.