Skip to content

Commit

Permalink
fix: ShowMsgCount show mini aio msg count
Browse files Browse the repository at this point in the history
Closes #1159
  • Loading branch information
HdShare committed Sep 1, 2024
1 parent 38b66c8 commit aabc48a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions app/src/main/java/cc/ioctl/hook/msg/ShowMsgCount.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import cc.ioctl.util.HookUtils.BeforeAndAfterHookedMethod
import cc.ioctl.util.HookUtils.hookBeforeAndAfterIfEnabled
import cc.ioctl.util.LayoutHelper
import cc.ioctl.util.hookBeforeIfEnabled
import com.github.kyuubiran.ezxhelper.utils.findFieldObjectAs
import com.github.kyuubiran.ezxhelper.utils.hookAfter
import io.github.qauxv.base.annotation.FunctionHookEntry
import io.github.qauxv.base.annotation.UiItemAgentEntry
Expand All @@ -40,8 +41,10 @@ import io.github.qauxv.util.dexkit.AIOTitleVB_updateLeftTopBack_NT
import io.github.qauxv.util.dexkit.CCustomWidgetUtil_updateCustomNoteTxt_NT
import io.github.qauxv.util.dexkit.DexKit
import io.github.qauxv.util.dexkit.NCustomWidgetUtil_updateCustomNoteTxt
import io.github.qauxv.util.hostInfo
import io.github.qauxv.util.requireMinQQVersion
import io.github.qauxv.util.xpcompat.XC_MethodHook.MethodHookParam
import me.ketal.util.findViewByType
import xyz.nextalone.util.get
import xyz.nextalone.util.throwOrTrue

Expand Down Expand Up @@ -77,6 +80,24 @@ object ShowMsgCount : CommonSwitchFunctionHook(
}
}

if (QQVersion.QQ_8_9_63 <= hostInfo.versionCode && hostInfo.versionCode <= QQVersion.QQ_9_0_68) {
// 隐藏会话右上角消息数量
Initiator.loadClass("com.tencent.mobileqq.activity.miniaio.h")
.getDeclaredMethod("updateUnreadCount", Int::class.java, Boolean::class.java)
.hookAfter { param ->
val tv = if (requireMinQQVersion(QQVersion.QQ_9_0_60)) {
val view = param.thisObject.get("h") as ViewGroup
view.findViewByType(TextView::class.java) as TextView
} else {
param.thisObject.findFieldObjectAs {
type == TextView::class.java
}
}
val count = param.args[0] as Int
tv.text = count.toString()
}
}

if (requireMinQQVersion(QQVersion.QQ_9_0_8)) {
// 群消息数量 + 群聊左上角返回消息数量
val clz = Initiator.loadClass("com.tencent.mobileqq.quibadge.QUIBadge")
Expand Down

0 comments on commit aabc48a

Please sign in to comment.