From 8f420616b4169bdc571e57b540ffd6100cdd1833 Mon Sep 17 00:00:00 2001 From: klxiaoniu Date: Thu, 6 Jul 2023 20:02:51 +0800 Subject: [PATCH] fix: AutoSendOriginalPhoto for QQ 8.9.68 --- .../java/xyz/nextalone/hook/AutoSendOriginalPhoto.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/xyz/nextalone/hook/AutoSendOriginalPhoto.kt b/app/src/main/java/xyz/nextalone/hook/AutoSendOriginalPhoto.kt index 023f0229e0..71e88320a8 100644 --- a/app/src/main/java/xyz/nextalone/hook/AutoSendOriginalPhoto.kt +++ b/app/src/main/java/xyz/nextalone/hook/AutoSendOriginalPhoto.kt @@ -28,7 +28,6 @@ import android.widget.CheckBox import cc.hicore.QApp.QAppUtils import cc.ioctl.util.HookUtils import com.github.kyuubiran.ezxhelper.utils.hookBefore -import com.tencent.mobileqq.widget.QUICheckBox import de.robv.android.xposed.XposedBridge import io.github.qauxv.base.annotation.FunctionHookEntry import io.github.qauxv.base.annotation.UiItemAgentEntry @@ -39,7 +38,6 @@ import io.github.qauxv.util.SyncUtils import io.github.qauxv.util.requireMinQQVersion import xyz.nextalone.util.clazz import xyz.nextalone.util.findHostView -import xyz.nextalone.util.get import xyz.nextalone.util.hookAfter import xyz.nextalone.util.method import xyz.nextalone.util.throwOrTrue @@ -55,8 +53,14 @@ object AutoSendOriginalPhoto : CommonSwitchFunctionHook(SyncUtils.PROC_MAIN or S override fun initOnce() = throwOrTrue { if (QAppUtils.isQQnt()) { //截至2023.6.21,仍有一些项目在使用旧版组件(如频道),故保留其他hook //Lcom/tencent/mobileqq/e/a/ac;->f:Lcom/tencent/mobileqq/widget/QUICheckBox; //普通模式半屏Panel的原图勾选框 + //8.9.68 变为 com.tencent.biz.qui.quicheckbox.QUICheckBox XposedBridge.hookAllConstructors("com.tencent.mobileqq.e.a.ac".clazz!!, HookUtils.afterIfEnabled(this) { param -> - param.thisObject.get("f", QUICheckBox::class.java)!!.isChecked = true + param.thisObject.javaClass.declaredFields.forEach { field -> + if (field.type.name.endsWith("QUICheckBox")) { + field.isAccessible = true + (field.get(param.thisObject) as CheckBox).isChecked = true + } + } }) //新全屏相册活动 "com.tencent.qqnt.qbasealbum.WinkHomeActivity".clazz!!.method("onCreate")!!.hookBefore {