From 9b115709b74fcb410a4165cde93e7a5a95041905 Mon Sep 17 00:00:00 2001 From: lliioollzh Date: Tue, 4 Jul 2023 01:43:36 +0800 Subject: [PATCH] fix: SimplifyQQSettingMe --- .../hook/sideswipe/SimplifyQQSettingMe.kt | 77 +++++++++++++++---- 1 file changed, 62 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/cc/ioctl/hook/sideswipe/SimplifyQQSettingMe.kt b/app/src/main/java/cc/ioctl/hook/sideswipe/SimplifyQQSettingMe.kt index 17748a7fdd..d4d5c14c01 100644 --- a/app/src/main/java/cc/ioctl/hook/sideswipe/SimplifyQQSettingMe.kt +++ b/app/src/main/java/cc/ioctl/hook/sideswipe/SimplifyQQSettingMe.kt @@ -26,12 +26,18 @@ import android.view.ViewGroup import android.view.ViewTreeObserver import android.widget.LinearLayout import android.widget.TextView +import android.widget.Toast import androidx.core.view.forEach import androidx.core.view.forEachIndexed import androidx.core.view.get import androidx.core.view.size import cc.ioctl.util.HookUtils +import cc.ioctl.util.HostInfo +import com.github.kyuubiran.ezxhelper.utils.findAllMethods +import com.github.kyuubiran.ezxhelper.utils.findMethod import com.github.kyuubiran.ezxhelper.utils.getStaticObjectOrNull +import com.github.kyuubiran.ezxhelper.utils.hookAfter +import com.github.kyuubiran.ezxhelper.utils.paramCount import com.github.kyuubiran.ezxhelper.utils.setViewZeroSize import de.robv.android.xposed.XC_MethodReplacement import de.robv.android.xposed.XposedBridge @@ -47,6 +53,7 @@ import io.github.qauxv.util.QQVersion.QQ_8_6_0 import io.github.qauxv.util.QQVersion.QQ_8_6_5 import io.github.qauxv.util.QQVersion.QQ_8_8_11 import io.github.qauxv.util.QQVersion.QQ_8_9_23 +import io.github.qauxv.util.Toasts import io.github.qauxv.util.hostInfo import io.github.qauxv.util.requireMinQQVersion import xyz.nextalone.base.MultiItemDelayableHook @@ -54,6 +61,7 @@ import xyz.nextalone.util.clazz import xyz.nextalone.util.get import xyz.nextalone.util.hide import xyz.nextalone.util.throwOrTrue +import java.util.HashMap import java.util.SortedMap //侧滑栏精简 @@ -75,25 +83,44 @@ object SimplifyQQSettingMe : MultiItemDelayableHook("SimplifyQQSettingMe") { "夜间模式", //夜间模式 [0,1,0,0,0,1,6,1] "登录达人", //登录达人 [0,1,0,0,0,1,6,2] "当前温度", //当前温度 [0,1,0,0,0,1,6,3] - "开播啦鹅", //开播啦鹅 [0,1,0,0,0,1,4,0,1] || [0,1,0,0,0,1,4,0,1,1,1] - "我的小世界", //我的小世界 [0,1,0,0,0,1,4,0,2] || [0,1,0,0,0,1,4,0,1,2,1] - "开通会员", //开通会员 [0,1,0,0,0,1,4,0,3] || [0,1,0,0,0,1,4,0,1,3,1] - "我的钱包", //我的钱包 [0,1,0,0,0,1,4,0,4] || [0,1,0,0,0,1,4,0,1,4,1] - "个性装扮", //个性装扮 [0,1,0,0,0,1,4,0,5] || [0,1,0,0,0,1,4,0,1,5,1] - "情侣空间", //情侣空间 [0,1,0,0,0,1,4,0,6] || [0,1,0,0,0,1,4,0,1,6,1] - "我的收藏", //我的收藏 [0,1,0,0,0,1,4,0,7] || [0,1,0,0,0,1,4,0,1,7,1] - "我的相册", //我的相册 [0,1,0,0,0,1,4,0,8] || [0,1,0,0,0,1,4,0,1,8,1] - "我的文件", //我的文件 [0,1,0,0,0,1,4,0,9] || [0,1,0,0,0,1,4,0,1,9,1] - "我的日程", //我的日程 [0,1,0,0,0,1,4,0,10] || [0,1,0,0,0,1,4,0,1,10,1] - "我的视频", //我的视频 [0,1,0,0,0,1,4,0,11] || [0,1,0,0,0,1,4,0,1,11,1] - "小游戏", //小游戏 [0,1,0,0,0,1,4,0,12] || [0,1,0,0,0,1,4,0,1,12,1] - "腾讯文档", //腾讯文档 [0,1,0,0,0,1,4,0,13] || [0,1,0,0,0,1,4,0,1,13,1] + "开播啦鹅", //开播啦鹅 [0,1,0,0,0,1,4,0,1] || [0,1,0,0,0,1,4,0,1,1,1] || d_qq_shopping 大概? + "我的小世界", //我的小世界 [0,1,0,0,0,1,4,0,2] || [0,1,0,0,0,1,4,0,1,2,1] || d_smallworld + "开通会员", //开通会员 [0,1,0,0,0,1,4,0,3] || [0,1,0,0,0,1,4,0,1,3,1] || d_vip_identity + "我的钱包", //我的钱包 [0,1,0,0,0,1,4,0,4] || [0,1,0,0,0,1,4,0,1,4,1] || d_qqwallet + "个性装扮", //个性装扮 [0,1,0,0,0,1,4,0,5] || [0,1,0,0,0,1,4,0,1,5,1] || d_decoration + "情侣空间", //情侣空间 [0,1,0,0,0,1,4,0,6] || [0,1,0,0,0,1,4,0,1,6,1] || d_lovespace + "我的收藏", //我的收藏 [0,1,0,0,0,1,4,0,7] || [0,1,0,0,0,1,4,0,1,7,1] || d_favorite + "我的相册", //我的相册 [0,1,0,0,0,1,4,0,8] || [0,1,0,0,0,1,4,0,1,8,1] || d_album + "我的文件", //我的文件 [0,1,0,0,0,1,4,0,9] || [0,1,0,0,0,1,4,0,1,9,1] || d_document + "我的日程", //我的日程 [0,1,0,0,0,1,4,0,10] || [0,1,0,0,0,1,4,0,1,10,1] || 未知,可能已被移除 + "我的视频", //我的视频 [0,1,0,0,0,1,4,0,11] || [0,1,0,0,0,1,4,0,1,11,1] || d_video + "小游戏", //小游戏 [0,1,0,0,0,1,4,0,12] || [0,1,0,0,0,1,4,0,1,12,1] || d_minigame + "腾讯文档", //腾讯文档 [0,1,0,0,0,1,4,0,13] || [0,1,0,0,0,1,4,0,1,13,1] || d_tencent_document "每日打卡", //每日打卡 [0,1,0,0,0,1,4,0,14] || [0,1,0,0,0,1,4,0,1,14,1] - "王卡免流量特权", //开通王卡 [0,1,0,0,0,1,4,0,15] || [0,1,0,0,0,1,4,0,1,15,1] - "厘米秀", + "王卡免流量特权", //开通王卡 [0,1,0,0,0,1,4,0,15] || [0,1,0,0,0,1,4,0,1,15,1] || d_vip_card + "厘米秀", // d_cmshow + "超级QQ秀", // d_zplan "等级" ) + var items2Hide: MutableMap = mutableMapOf( + Pair("开播啦鹅", "d_qq_shopping"), //开播啦鹅 [0,1,0,0,0,1,4,0,1] || [0,1,0,0,0,1,4,0,1,1,1] || d_qq_shopping 大概? + Pair("我的小世界", "d_smallworld"), //我的小世界 [0,1,0,0,0,1,4,0,2] || [0,1,0,0,0,1,4,0,1,2,1] || d_smallworld + Pair("开通会员", "d_vip_identity"), //开通会员 [0,1,0,0,0,1,4,0,3] || [0,1,0,0,0,1,4,0,1,3,1] || d_vip_identity + Pair("我的钱包", "d_qqwallet"), //我的钱包 [0,1,0,0,0,1,4,0,4] || [0,1,0,0,0,1,4,0,1,4,1] || d_qqwallet + Pair("个性装扮", "d_decoration"), //个性装扮 [0,1,0,0,0,1,4,0,5] || [0,1,0,0,0,1,4,0,1,5,1] || d_decoration + Pair("情侣空间", "d_lovespace"), //情侣空间 [0,1,0,0,0,1,4,0,6] || [0,1,0,0,0,1,4,0,1,6,1] || d_lovespace + Pair("我的收藏", "d_favorite"), //我的收藏 [0,1,0,0,0,1,4,0,7] || [0,1,0,0,0,1,4,0,1,7,1] || d_favorite + Pair("我的相册", "d_album"), //我的相册 [0,1,0,0,0,1,4,0,8] || [0,1,0,0,0,1,4,0,1,8,1] || d_album + Pair("我的文件", "d_document"), //我的文件 [0,1,0,0,0,1,4,0,9] || [0,1,0,0,0,1,4,0,1,9,1] || d_document + Pair("我的视频", "d_video"), //我的视频 [0,1,0,0,0,1,4,0,11] || [0,1,0,0,0,1,4,0,1,11,1] || d_video + Pair("小游戏", "d_minigame"), //小游戏 [0,1,0,0,0,1,4,0,12] || [0,1,0,0,0,1,4,0,1,12,1] || d_minigame + Pair("腾讯文档", "d_tencent_document"), //腾讯文档 [0,1,0,0,0,1,4,0,13] || [0,1,0,0,0,1,4,0,1,13,1] || d_tencent_document + Pair("王卡免流量特权", "d_vip_card"), //开通王卡 [0,1,0,0,0,1,4,0,15] || [0,1,0,0,0,1,4,0,1,15,1] || d_vip_card + Pair("厘米秀", "d_cmshow"), // d_cmshow + Pair("超级QQ秀", "d_zplan")// d_zplan + ) + private val keyWords: SortedMap = sortedMapOf( "级" to "等级", "间" to "夜间模式", @@ -124,6 +151,7 @@ object SimplifyQQSettingMe : MultiItemDelayableHook("SimplifyQQSettingMe") { @Throws(Exception::class) override fun initOnce() = throwOrTrue { + val kQQSettingMeView = if (requireMinQQVersion(QQVersion.QQ_8_9_25)) Initiator.loadClass("com.tencent.mobileqq.activity.QQSettingMeView") else Initiator.loadClass("com.tencent.mobileqq.activity.QQSettingMe") @@ -196,6 +224,25 @@ object SimplifyQQSettingMe : MultiItemDelayableHook("SimplifyQQSettingMe") { } } }) + + // for NT QQ 8.9.68.11450 + val clazz = Initiator.load("com.tencent.mobileqq.activity.QQSettingMeViewV9") + if (clazz != null) { + clazz.findAllMethods { paramCount == 1 && parameterTypes[0].name.contains("com.tencent.mobileqq.activity.qqsettingme") } + .hookAfter { + val cz = clazz.superclass.superclass + val m = cz.findMethod { returnType == View::class.java && paramCount == 1 && parameterTypes[0] == String::class.java } + for (activeItem in activeItems) { + if (items2Hide.contains(activeItem)) { + val viewObj = m.invoke(null, items2Hide[activeItem]) + if (viewObj != null) { + val view = viewObj as View + view.visibility = View.GONE + } + } + } + } + } } private fun stringHit(string: String): Boolean {