Skip to content

Commit

Permalink
Version: 1.5.0
Browse files Browse the repository at this point in the history
1. 修复了自己撤回提示拦截的bug
2. 只hook关键进程,防止错误导致微信重启
  • Loading branch information
firesunCN committed Apr 18, 2018
1 parent ff520bb commit 3c9abf3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ android {
applicationId "me.firesun.wechat.enhancement"
minSdkVersion 17
targetSdkVersion 23
versionCode 38
versionName "1.4.0"
versionCode 39
versionName "1.5.0"
}

buildTypes {
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/java/me/firesun/wechat/enhancement/Main.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package me.firesun.wechat.enhancement;

import android.app.ActivityManager;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.util.Log;

import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodHook;
Expand Down Expand Up @@ -31,6 +33,13 @@ public void handleLoadPackage(final LoadPackageParam lpparam) {
protected void afterHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
Context context = (Context) param.args[0];
String processName = lpparam.processName;
//Only hook important process
if (!processName.equals(HookClasses.WECHAT_PACKAGE_NAME) &&
!processName.equals(HookClasses.WECHAT_PACKAGE_NAME + ":tools")
) {
return;
}
String versionName = getVersionName(context, HookClasses.WECHAT_PACKAGE_NAME);
log("Found wechat version:" + versionName);
if (HookClasses.versionName == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.content.ContentValues;


import java.io.File;
import java.util.Arrays;
import java.util.HashMap;
Expand Down Expand Up @@ -42,9 +43,10 @@ protected void beforeHookedMethod(MethodHookParam param) {

if (param.args[0].equals("message")) {
ContentValues contentValues = ((ContentValues) param.args[1]);

if (contentValues.getAsInteger("type") == 10000 &&
!contentValues.getAsString("content").equals(getString(R.string.revoke_prompt_msg))) {
!contentValues.getAsString("content").equals("你撤回了一条消息") &&
!contentValues.getAsString("content").equals("You've recalled a message")
) {
handleMessageRecall(contentValues);
param.setResult(1);
}
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<string name="button_select_all">全选</string>
<string name="pref_enable_anti_revoke">消息防撤回</string>
<string name="pref_enable_anti_sns_delete">朋友圈防删除</string>
<string name="revoke_prompt_msg">你撤回了一条消息</string>
<string name="pref_show_icon">显示图标</string>
<string name="repair">尝试修复插件</string>
<string name="repair_done">修复完成,请重启微信</string>
Expand Down

0 comments on commit 3c9abf3

Please sign in to comment.