Skip to content

Commit

Permalink
[add] 适配微信8.0.41
Browse files Browse the repository at this point in the history
  • Loading branch information
Mingyueyixi committed Sep 10, 2023
1 parent 609ca4e commit c030abf
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 18 deletions.
1 change: 1 addition & 0 deletions app/src/main/java/com/lu/wxmask/Constrant.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class Constrant {
const val WX_CODE_8_0_37 = 2380
const val WX_CODE_8_0_38 = 2400
const val WX_CODE_8_0_40 = 2420
const val WX_CODE_8_0_41 = 2441
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class EmptySingChatHistoryGalleryPluginPart : IPlugin {
private fun setEmptyDetailHistoryUIForMedia(context: Context, lpparam: XC_LoadPackage.LoadPackageParam?) {
var mediaMethodName = when (AppVersionUtil.getVersionCode()) {
in Constrant.WX_CODE_8_0_32..Constrant.WX_CODE_8_0_35 -> "k"
in Constrant.WX_CODE_8_0_35..Constrant.WX_CODE_8_0_40 -> "l"
in Constrant.WX_CODE_8_0_35..Constrant.WX_CODE_8_0_41 -> "l"
else -> "l"
}
val MediaHistoryListUI = "com.tencent.mm.ui.chatting.gallery.MediaHistoryListUI"
Expand Down Expand Up @@ -82,7 +82,7 @@ class EmptySingChatHistoryGalleryPluginPart : IPlugin {
val MediaHistoryGalleryUI = "com.tencent.mm.ui.chatting.gallery.MediaHistoryGalleryUI"
val methodName = when (AppVersionUtil.getVersionCode()) {
in Constrant.WX_CODE_8_0_22..Constrant.WX_CODE_8_0_35 -> "k"
in Constrant.WX_CODE_8_0_35 .. Constrant.WX_CODE_8_0_40 -> "l"
in Constrant.WX_CODE_8_0_35..Constrant.WX_CODE_8_0_41 -> "l"
else -> null
}
var galleryMethod: Method? = null
Expand Down Expand Up @@ -141,10 +141,11 @@ class EmptySingChatHistoryGalleryPluginPart : IPlugin {
if (AppVersionUtil.getVersionName() == "8.0.35") "P"
else "R"
}

Constrant.WX_CODE_8_0_35 -> "P"
Constrant.WX_CODE_8_0_37 -> "Q"
Constrant.WX_CODE_8_0_38 -> "R"
Constrant.WX_CODE_8_0_40 -> "Q"
in Constrant.WX_CODE_8_0_40..Constrant.WX_CODE_8_0_41 -> "Q"
else -> null
}
LogUtil.d("setEmptyActionBarTabPageUI method is :", commonHookMethodName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ class EnterChattingUIPluginPart() : IPlugin {
if (AppVersionUtil.getVersionName() == "8.0.35") "J"
else "M"
}

Constrant.WX_CODE_8_0_35 -> "J"
Constrant.WX_CODE_8_0_37 -> "K"
Constrant.WX_CODE_8_0_38 -> "M"
Constrant.WX_CODE_8_0_40 -> "K"
in Constrant.WX_CODE_8_0_40..Constrant.WX_CODE_8_0_41 -> "K"
else -> null
}
var dispatchMethod: Method? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import java.lang.reflect.Method
class HideMainUIListPluginPart : IPlugin {

override fun handleHook(context: Context, lpparam: XC_LoadPackage.LoadPackageParam) {
handleMainUIChattingListView(context, lpparam)
runCatching {
handleMainUIChattingListView2(context, lpparam)
}.onFailure {
Expand All @@ -51,7 +50,7 @@ class HideMainUIListPluginPart : IPlugin {
}

Constrant.WX_CODE_8_0_35 -> "com.tencent.mm.ui.conversation.r"
in Constrant.WX_CODE_8_0_35..Constrant.WX_CODE_8_0_40 -> "com.tencent.mm.ui.conversation.x"
in Constrant.WX_CODE_8_0_35..Constrant.WX_CODE_8_0_41 -> "com.tencent.mm.ui.conversation.x"
else -> null
}
var adapterClazz: Class<*>? = null
Expand All @@ -69,15 +68,16 @@ class HideMainUIListPluginPart : IPlugin {
"setAdapter",
ListAdapter::class.java
)
if (setAdapterMethod != null) {
if (setAdapterMethod == null) {
LogUtil.w( "setAdapterMethod is null")
return
}
XposedHelpers2.hookMethod(
setAdapterMethod,
object : XC_MethodHook2() {
override fun afterHookedMethod(param: MethodHookParam) {
val adapter = param.args[0] ?: return
LogUtil.d("List adapter ", adapter)
LogUtil.i("hook List adapter ", adapter)
if (adapter::class.java.name.startsWith("com.tencent.mm.ui.conversation")) {
LogUtil.w(AppVersionUtil.getSmartVersionName(), "guess adapter: ", adapter)
hookListViewAdapter(adapter.javaClass)
Expand Down Expand Up @@ -147,16 +147,17 @@ class HideMainUIListPluginPart : IPlugin {
//带文字的未读红点
val tipTvIdTextID = when (AppVersionUtil.getVersionCode()) {
in 0..Constrant.WX_CODE_8_0_22 -> "tipcnt_tv"
in Constrant.WX_CODE_8_0_22..Constrant.WX_CODE_8_0_38 -> "kmv"
in Constrant.WX_CODE_8_0_22..Constrant.WX_CODE_8_0_41 -> "kmv"
else -> "kmv"
}
val tipTvId = ResUtil.getViewId(tipTvIdTextID)
itemView.findViewById<View>(tipTvId)?.visibility = View.INVISIBLE

//头像上的小红点
val small_red = when (AppVersionUtil.getVersionCode()) {
in 0..Constrant.WX_CODE_8_0_38 -> "a2f"
else -> "a2f"
in 0..Constrant.WX_CODE_8_0_40 -> "a2f"
Constrant.WX_CODE_8_0_41 -> "o_u"
else -> "o_u"
}
val viewId = ResUtil.getViewId(small_red)
itemView.findViewById<View>(viewId)?.visibility = View.INVISIBLE
Expand All @@ -166,8 +167,9 @@ class HideMainUIListPluginPart : IPlugin {
private fun hideMsgViewItemText(itemView: View, param: MethodHookParam) {
val msgTvIdName = when (AppVersionUtil.getVersionCode()) {
in 0..Constrant.WX_CODE_8_0_22 -> "last_msg_tv"
in Constrant.WX_CODE_8_0_22..Constrant.WX_CODE_8_0_38 -> "fhs"
else -> "fhs"
in Constrant.WX_CODE_8_0_22..Constrant.WX_CODE_8_0_40 -> "fhs"
Constrant.WX_CODE_8_0_41 -> "ht5"
else -> "ht5"
}
val lastMsgViewId = ResUtil.getViewId(msgTvIdName)
LogUtil.d("mask last msg textView", lastMsgViewId)
Expand Down Expand Up @@ -213,7 +215,7 @@ class HideMainUIListPluginPart : IPlugin {
Constrant.WX_CODE_8_0_22 -> "com.tencent.mm.ui.g"
in Constrant.WX_CODE_8_0_32..Constrant.WX_CODE_8_0_34 -> "com.tencent.mm.ui.y"
in Constrant.WX_CODE_8_0_35..Constrant.WX_CODE_8_0_38 -> "com.tencent.mm.ui.z"
// in Constrant.WX_CODE_8_0_38..Constrant.WX_CODE_8_0_40 -> "com.tencent.mm.ui.b0"
in Constrant.WX_CODE_8_0_40..Constrant.WX_CODE_8_0_41 -> "com.tencent.mm.ui.b0"
else -> null
}
var getItemMethod = if (adapterClazzName != null && getItemMethodName != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class HideSearchListUIPluginPart : IPlugin {

private fun handleDetailSearch(context: Context, lpparam: XC_LoadPackage.LoadPackageParam) {
var hookClazzName = when (AppVersionUtil.getVersionCode()) {
in Constrant.WX_CODE_8_0_38.. Constrant.WX_CODE_8_0_40 -> "com.tencent.mm.plugin.fts.ui.x"
in Constrant.WX_CODE_8_0_38.. Constrant.WX_CODE_8_0_41 -> "com.tencent.mm.plugin.fts.ui.x"
else -> "com.tencent.mm.plugin.fts.ui.y"
}
//全局搜索详情置空
Expand Down Expand Up @@ -103,7 +103,7 @@ class HideSearchListUIPluginPart : IPlugin {
// val wxVersionCode = AppVersionUtil.getVersionCode()
// 理论上 hook com.tencent.mm.plugin.fts.ui.z#getItem 也是一样的,但是被覆盖重命名了
var hookClazzName = when (AppVersionUtil.getVersionCode()) {
in Constrant.WX_CODE_8_0_38 .. Constrant.WX_CODE_8_0_40 -> "com.tencent.mm.plugin.fts.ui.y"
in Constrant.WX_CODE_8_0_38 .. Constrant.WX_CODE_8_0_41 -> "com.tencent.mm.plugin.fts.ui.y"
else -> "com.tencent.mm.plugin.fts.ui.z"
}
//全局搜索首页
Expand Down Expand Up @@ -162,7 +162,7 @@ class HideSearchListUIPluginPart : IPlugin {
}
if (chatUser == null) {
when (AppVersionUtil.getVersionCode()) {
in Constrant.WX_CODE_8_0_33..Constrant.WX_CODE_8_0_40 -> {
in Constrant.WX_CODE_8_0_33..Constrant.WX_CODE_8_0_41 -> {
val fieldValue: Any = XposedHelpers2.getObjectField<Any?>(itemData, "p") ?: return false
chatUser = XposedHelpers2.getObjectField<String?>(fieldValue, "e")
}
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/lu/wxmask/util/AppVersionUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ class AppVersionUtil {
Constrant.WX_CODE_8_0_35,
Constrant.WX_CODE_8_0_37,
Constrant.WX_CODE_8_0_38,
Constrant.WX_CODE_8_0_40 -> true
Constrant.WX_CODE_8_0_40,
Constrant.WX_CODE_8_0_41 -> true

else -> false
}
Expand Down

0 comments on commit c030abf

Please sign in to comment.