Skip to content

Commit

Permalink
Fixed some problems with the purification list.
Browse files Browse the repository at this point in the history
  • Loading branch information
leafmoes committed Dec 13, 2023
1 parent 90e09d4 commit db98d06
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 4 deletions.
35 changes: 34 additions & 1 deletion app/src/main/java/cc/ioctl/hook/sideswipe/SimplifyQQSettingMe.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,24 @@ 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.dexkit.DexKit
import io.github.qauxv.util.dexkit.QQ_SETTING_ME_CONFIG_CLASS
import io.github.qauxv.util.hostInfo
import io.github.qauxv.util.requireMinQQVersion
import xyz.nextalone.base.MultiItemDelayableHook
import xyz.nextalone.util.*
import xyz.nextalone.util.clazz
import xyz.nextalone.util.get
import xyz.nextalone.util.hide
import xyz.nextalone.util.throwOrTrue
import java.lang.reflect.Array
import java.lang.reflect.Modifier
import java.util.SortedMap

//侧滑栏精简
@FunctionHookEntry
@UiItemAgentEntry
object SimplifyQQSettingMe : MultiItemDelayableHook("SimplifyQQSettingMe") {
object SimplifyQQSettingMe : MultiItemDelayableHook("SimplifyQQSettingMe",targets = arrayOf(QQ_SETTING_ME_CONFIG_CLASS)) {

const val MidContentName = "SimplifyQQSettingMe::MidContentName"

Expand Down Expand Up @@ -238,6 +243,34 @@ object SimplifyQQSettingMe : MultiItemDelayableHook("SimplifyQQSettingMe") {
if (requireMinQQVersion(QQVersion.QQ_8_9_88)) "com.tencent.mobileqq.QQSettingMeViewV9"
else "com.tencent.mobileqq.activity.QQSettingMeViewV9"
)

// 转化为View之前删除数据
if (requireMinQQVersion(QQVersion.QQ_8_9_90)) {
val m = DexKit.requireClassFromCache(QQ_SETTING_ME_CONFIG_CLASS).declaredMethods.first { it.isPublic && it.returnType.name.contains("QQSettingMeBizBean") }
m.hookAfter { param ->
val qqSettingMeBizBeanArray = param.result
val cSettingMeBizBean = qqSettingMeBizBeanArray::class.java.componentType!!
// 先初始化一个可变列表
val purifiedList = mutableListOf<Any>()
// 遍历这个数组
for (i in 0 until Array.getLength(param.result) - 1) {
// 获取单个QQSettingMeBizBean
val item = Array.get(qqSettingMeBizBeanArray,i)!!
val itemId = item.get(String::class.java) as String
// 获取需要被删掉的列表 ( 超级QQ秀直接删除有bug[空指针(QQ你怎么不校验一下,哭)],应该在View里面隐藏
val del = items2Hide.filter { activeItems.contains(it.key) }.values.toMutableList().apply { remove("d_zplan") }
// 如果不为需要删除的,就添加到返回列表
if (!del.contains(itemId)){ purifiedList.add(item) }
}
val returnArray = Array.newInstance(cSettingMeBizBean,purifiedList.size)
for (i in purifiedList.indices){
Array.set(returnArray,i,purifiedList[i])
}
param.result = returnArray
}
}

// View层隐藏超级QQ秀 (到这里应该只需要处理 超级QQ秀 了
if (requireMinQQVersion(QQVersion.QQ_9_0_0)) {
if (clazz != null) {
val cz = clazz.superclass.superclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ abstract class CommonConfigFunctionHook(
constructor() : this(null, false)
constructor(defaultEnabled: Boolean) : this(null, defaultEnabled)
constructor(key: String) : this(key, false)
constructor(key: String, targets: Array<DexKitTarget>) : this(key, false, targets)
constructor(key: String, targets: Array<DexKitTarget>?) : this(key, false, targets)
constructor(targets: Array<DexKitTarget>) : this(null, false, targets)
constructor(key: String, targetProc: Int) : this(hookKey = key, targetProc = targetProc)
constructor(targetProc: Int) : this(null, targetProc = targetProc)
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/java/io/github/qauxv/util/dexkit/DexKitTarget.kt
Original file line number Diff line number Diff line change
Expand Up @@ -835,3 +835,11 @@ data object EmotionDownloadEnableSwitch: DexKitTarget.UsingStringVector() {
override val declaringClass: String = ""
override val filter = DexKitFilter.strInClsName("com/tencent/mobileqq/emotionintegrate/")
}


data object QQ_SETTING_ME_CONFIG_CLASS: DexKitTarget.UsingStringVector() {
override val findMethod: Boolean = false;
override val traitStringVectors: Array<Array<String>> = arrayOf(arrayOf("超级QQ秀","我的视频","我的文件","我的收藏","我的相册","我的小游戏","免流量","我的个性装扮","财富小金库","我的QQ钱包","开通会员","我的小世界","直播"))
override val declaringClass: String = ""
override val filter = DexKitFilter.allowAll
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ import io.github.qauxv.hook.CommonConfigFunctionHook
import io.github.qauxv.ui.CommonContextWrapper
import io.github.qauxv.util.Log
import io.github.qauxv.util.Toasts
import io.github.qauxv.util.dexkit.DexKitTarget
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.update
import me.ketal.data.ConfigData

abstract class MultiItemDelayableHook(keyName: String) :
CommonConfigFunctionHook(keyName) {
abstract class MultiItemDelayableHook(keyName: String,targets: Array<DexKitTarget>? = null) :
CommonConfigFunctionHook(keyName,targets) {
abstract val preferenceTitle: String
open val preferenceSummary = ""

Expand Down

0 comments on commit db98d06

Please sign in to comment.