Skip to content

Commit

Permalink
fix: SimplifyQQSettingMe for QQ 8.9.90
Browse files Browse the repository at this point in the history
  • Loading branch information
klxiaoniu committed Nov 16, 2023
1 parent a79dd6c commit 8095079
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 27 deletions.
56 changes: 31 additions & 25 deletions app/src/main/java/cc/ioctl/hook/sideswipe/SimplifyQQSettingMe.kt
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,11 @@ 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")
val kQQSettingMeView = Initiator.loadClass(
if (requireMinQQVersion(QQVersion.QQ_8_9_90)) "com.tencent.mobileqq.QQSettingMeView"
else if (requireMinQQVersion(QQVersion.QQ_8_9_25)) "com.tencent.mobileqq.activity.QQSettingMeView"
else "com.tencent.mobileqq.activity.QQSettingMe"
)
XposedBridge.hookAllConstructors(kQQSettingMeView, HookUtils.afterIfEnabled(this) { param ->
//中间部分(QQ会员 我的钱包等)
val midContentName = ConfigTable.getConfig<String>(MidContentName)
Expand All @@ -168,6 +170,26 @@ object SimplifyQQSettingMe : MultiItemDelayableHook("SimplifyQQSettingMe") {
} else {
param.thisObject.get(midContentName, View::class.java) as LinearLayout
}
val midRemovedList: MutableList<Int> = mutableListOf()
midContentListLayout?.forEach {
val child = it as LinearLayout
val tv = if (child.size == 1) {
(child[0] as LinearLayout)[1]
} else {
child[1]
} as TextView
val text = tv.text.toString()
if (stringHit(text)) {
midRemovedList.add(midContentListLayout.indexOfChild(child))
}
}
midRemovedList.sorted().forEachIndexed { index, i ->
if (requireMinQQVersion(QQ_8_8_11)) {
midContentListLayout?.removeViewAt(i - index)
} else {
midContentListLayout?.getChildAt(i)?.hide()
}
}
//底端部分 设置 夜间模式 达人 等
val vg = param.args.last()
val id = "${hostInfo.packageName}.R\$id".clazz?.getStaticObjectOrNull("drawer_bottom_container")
Expand Down Expand Up @@ -195,27 +217,8 @@ object SimplifyQQSettingMe : MultiItemDelayableHook("SimplifyQQSettingMe") {
v.setViewZeroSize()
}
}
val midRemovedList: MutableList<Int> = mutableListOf()
midContentListLayout?.forEach {
val child = it as LinearLayout
val tv = if (child.size == 1) {
(child[0] as LinearLayout)[1]
} else {
child[1]
} as TextView
val text = tv.text.toString()
if (stringHit(text)) {
midRemovedList.add(midContentListLayout.indexOfChild(child))
}
}
midRemovedList.sorted().forEachIndexed { index, i ->
if (requireMinQQVersion(QQ_8_8_11)) {
midContentListLayout?.removeViewAt(i - index)
} else {
midContentListLayout?.getChildAt(i)?.hide()
}
}
})

XposedBridge.hookAllMethods(ViewTreeObserver::class.java, "dispatchOnGlobalLayout", object : XC_MethodReplacement() {
override fun replaceHookedMethod(param: MethodHookParam) {
try {
Expand All @@ -231,7 +234,10 @@ object SimplifyQQSettingMe : MultiItemDelayableHook("SimplifyQQSettingMe") {
})

// for NT QQ 8.9.68.11450
val clazz = Initiator.load("com.tencent.mobileqq.activity.QQSettingMeViewV9")
val clazz = Initiator.load(
if (requireMinQQVersion(QQVersion.QQ_8_9_90)) "com.tencent.mobileqq.QQSettingMeViewV9"
else "com.tencent.mobileqq.activity.QQSettingMeViewV9"
)
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 }
Expand All @@ -248,7 +254,7 @@ object SimplifyQQSettingMe : MultiItemDelayableHook("SimplifyQQSettingMe") {

// 关闭下拉形象展示abtest开关
if (activeItems.contains("下拉形象展示")) {
Initiator.load("com.tencent.mobileqq.activity.qqsettingme.utils.a")?.getDeclaredMethod("f")!!
Initiator.load("com.tencent.mobileqq.activity.qqsettingme.utils.a")?.getDeclaredMethod(if (requireMinQQVersion(QQVersion.QQ_8_9_90)) "g" else "f")!!
.hookBefore { it.result = false }
}
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/io/github/qauxv/tlb/QQConfigTable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import io.github.qauxv.util.QQVersion.QQ_8_9_63
import io.github.qauxv.util.QQVersion.QQ_8_9_68
import io.github.qauxv.util.QQVersion.QQ_8_9_70
import io.github.qauxv.util.QQVersion.QQ_8_9_8
import io.github.qauxv.util.QQVersion.QQ_8_9_90
import me.ketal.hook.SortAtPanel
import xyz.nextalone.hook.ChatWordsCount

Expand Down Expand Up @@ -121,6 +122,7 @@ class QQConfigTable : ConfigTableInterface {
QQ_8_9_25 to "l0",
QQ_8_9_28 to "m0",
QQ_8_9_68 to "l0",
QQ_8_9_90 to "i0",
),

SortAtPanel.sessionInfoTroopUin to mapOf(
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/io/github/qauxv/util/QQVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,5 @@ private QQVersion() {
public static final long QQ_8_9_83 = 4680;
public static final long qq_8_9_85 = 4766;
public static final long QQ_8_9_88 = 4852;
public static final long QQ_8_9_90 = 4938;
}
5 changes: 3 additions & 2 deletions app/src/main/java/me/ketal/hook/HideTab.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ object HideTab : CommonSwitchFunctionHook() {
}
}
}
(if (requireMinQQVersion(QQVersion.QQ_8_9_25)) "com.tencent.mobileqq.activity.QQSettingMeView" else
"com.tencent.mobileqq.activity.QQSettingMe").clazz?.hookAfterAllConstructors {
(if (requireMinQQVersion(QQVersion.QQ_8_9_90)) "com.tencent.mobileqq.QQSettingMeView"
else if (requireMinQQVersion(QQVersion.QQ_8_9_25)) "com.tencent.mobileqq.activity.QQSettingMeView"
else "com.tencent.mobileqq.activity.QQSettingMe").clazz?.hookAfterAllConstructors {
if (!isEnabled) return@hookAfterAllConstructors
val midContentName = ConfigTable.getConfig<String>(SimplifyQQSettingMe.MidContentName)
val linearLayout = if (requireMinQQVersion(QQVersion.QQ_8_6_5)) {
Expand Down

0 comments on commit 8095079

Please sign in to comment.