Skip to content

Commit

Permalink
fix: SimplifyQQSettings MethodNotFound
Browse files Browse the repository at this point in the history
  • Loading branch information
klxiaoniu committed Dec 8, 2024
1 parent 5f20694 commit 405f777
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions app/src/main/java/xyz/nextalone/hook/SimplifyQQSettings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,22 @@
package xyz.nextalone.hook

import android.app.Activity
import android.content.Context
import android.view.View
import android.widget.LinearLayout
import android.widget.RelativeLayout
import cc.hicore.ReflectUtil.MField
import cc.ioctl.util.Reflex
import com.github.kyuubiran.ezxhelper.utils.getFieldByType
import com.github.kyuubiran.ezxhelper.utils.hookAfter
import com.github.kyuubiran.ezxhelper.utils.paramCount
import io.github.qauxv.util.xpcompat.XC_MethodHook
import io.github.qauxv.util.xpcompat.XposedBridge
import io.github.qauxv.util.xpcompat.XposedHelpers
import io.github.qauxv.base.annotation.FunctionHookEntry
import io.github.qauxv.base.annotation.UiItemAgentEntry
import io.github.qauxv.dsl.FunctionEntryRouter
import io.github.qauxv.util.Initiator
import io.github.qauxv.util.QQVersion
import io.github.qauxv.util.requireMinQQVersion
import io.github.qauxv.util.xpcompat.XC_MethodHook
import io.github.qauxv.util.xpcompat.XposedBridge
import me.ketal.util.hookMethod
import xyz.nextalone.base.MultiItemDelayableHook
import xyz.nextalone.util.clazz
Expand Down Expand Up @@ -122,20 +121,15 @@ object SimplifyQQSettings : MultiItemDelayableHook("na_simplify_qq_settings_mult
if (activeItems.contains("免流量")) {
// if() CUOpenCardGuideMng guideEntry
if (requireMinQQVersion(QQVersion.QQ_9_0_30)) {
// Initiator.loadClass("com.tencent.mobileqq.setting.main.MainSettingConfigProvider").method("d")?.hookAfter {
// it.result = (it.result as List<*>).filterIndexed { index, i -> index != 5 }
// } ?: throw NoSuchMethodException("com.tencent.mobileqq.setting.main.MainSettingConfigProvider.d")
XposedHelpers.findAndHookMethod("com.tencent.mobileqq.setting.main.MainSettingConfigProvider", Initiator.getHostClassLoader(), "d",
Context::class.java, object : XC_MethodHook() {
override fun afterHookedMethod(param: MethodHookParam) {
param.result = (param.result as List<*>).filter { obj ->
(((obj ?: return@filter true)::class.java.getFieldByType(List::class.java).get(obj)
?: return@filter true) as List<*>).firstOrNull {
(it ?: return@firstOrNull false)::class.java.simpleName == "CUOpenCardItemProcessor"
} == null
}
Initiator.loadClass("com.tencent.mobileqq.setting.main.MainSettingConfigProvider").method { it.returnType == List::class.java }!!
.hookAfter { param ->
param.result = (param.result as List<*>).filter { obj ->
(((obj ?: return@filter true)::class.java.getFieldByType(List::class.java).get(obj)
?: return@filter true) as List<*>).firstOrNull {
(it ?: return@firstOrNull false)::class.java.simpleName == "CUOpenCardItemProcessor"
} == null
}
})
}
} else if (requireMinQQVersion(QQVersion.QQ_8_9_63_BETA_11345)) {
//Lcom/tencent/mobileqq/managers/CUOpenCardGuideMng;->b(I)Lcom/tencent/mobileqq/managers/CUOpenCardGuideMng$a;
Initiator.loadClass("com/tencent/mobileqq/managers/CUOpenCardGuideMng").let { clz ->
Expand Down

0 comments on commit 405f777

Please sign in to comment.