diff --git a/app/build.gradle b/app/build.gradle index 779ceb0..c702fbb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -23,8 +23,8 @@ android { applicationId "me.firesun.wechat.enhancement" minSdkVersion 15 targetSdkVersion 23 - versionCode 36 - versionName "1.2.0" + versionCode 37 + versionName "1.3.0" } buildTypes { diff --git a/app/src/main/java/me/firesun/wechat/enhancement/Main.java b/app/src/main/java/me/firesun/wechat/enhancement/Main.java index 2ae44db..ec0677a 100644 --- a/app/src/main/java/me/firesun/wechat/enhancement/Main.java +++ b/app/src/main/java/me/firesun/wechat/enhancement/Main.java @@ -7,6 +7,7 @@ import me.firesun.wechat.enhancement.plugin.ADBlock; import me.firesun.wechat.enhancement.plugin.AntiRevoke; import me.firesun.wechat.enhancement.plugin.AntiSnsDelete; +import me.firesun.wechat.enhancement.plugin.AutoLogin; import me.firesun.wechat.enhancement.plugin.HideModule; import me.firesun.wechat.enhancement.plugin.LuckMoney; import me.firesun.wechat.enhancement.util.HookClasses; @@ -45,6 +46,7 @@ private void loadPlugins(LoadPackageParam lpparam) { AntiRevoke.getInstance().hook(lpparam); AntiSnsDelete.getInstance().hook(lpparam); LuckMoney.getInstance().hook(lpparam); + AutoLogin.getInstance().hook(lpparam); HideModule.getInstance().hook(lpparam); } catch (Error | Exception e) { log("loadPlugins error" + e); diff --git a/app/src/main/java/me/firesun/wechat/enhancement/PreferencesUtils.java b/app/src/main/java/me/firesun/wechat/enhancement/PreferencesUtils.java index 4803f33..b2464d2 100644 --- a/app/src/main/java/me/firesun/wechat/enhancement/PreferencesUtils.java +++ b/app/src/main/java/me/firesun/wechat/enhancement/PreferencesUtils.java @@ -73,6 +73,10 @@ public static boolean isADBlock() { return getInstance().getBoolean("is_adblock", false); } + public static boolean isAutoLogin() { + return getInstance().getBoolean("is_autologin", false); + } + } diff --git a/app/src/main/java/me/firesun/wechat/enhancement/plugin/AutoLogin.java b/app/src/main/java/me/firesun/wechat/enhancement/plugin/AutoLogin.java new file mode 100644 index 0000000..b75e3ca --- /dev/null +++ b/app/src/main/java/me/firesun/wechat/enhancement/plugin/AutoLogin.java @@ -0,0 +1,56 @@ +package me.firesun.wechat.enhancement.plugin; + + +import android.app.Activity; +import android.widget.Button; + +import java.lang.reflect.Field; + +import de.robv.android.xposed.XC_MethodHook; +import de.robv.android.xposed.XposedHelpers; +import de.robv.android.xposed.callbacks.XC_LoadPackage; +import me.firesun.wechat.enhancement.PreferencesUtils; +import me.firesun.wechat.enhancement.util.HookClasses; +import me.firesun.wechat.enhancement.util.ReflectionUtil; + +import static de.robv.android.xposed.XposedBridge.log; + + +public class AutoLogin { + private static AutoLogin instance = null; + + private AutoLogin() { + } + + public static AutoLogin getInstance() { + if (instance == null) + instance = new AutoLogin(); + return instance; + } + + public void hook(XC_LoadPackage.LoadPackageParam lpparam) { + XposedHelpers.findAndHookMethod(android.app.Activity.class, "onStart", new XC_MethodHook() { + @Override + protected void beforeHookedMethod(MethodHookParam param) { + try { + if (!PreferencesUtils.isAutoLogin()) + return; + Activity activity = (Activity) param.thisObject; + if (activity.getClass().getName().equals(HookClasses.WebWXLoginUIClassName)) { + Class clazz = activity.getClass(); + Field field = XposedHelpers.findFirstFieldByExactType(clazz, Button.class); + Button button = (Button) field.get(activity); + if (button != null) { + button.performClick(); + } + } + + } catch (Error | Exception e) { + log("error:" + e); + } + } + }); + + } + +} diff --git a/app/src/main/java/me/firesun/wechat/enhancement/plugin/LuckMoney.java b/app/src/main/java/me/firesun/wechat/enhancement/plugin/LuckMoney.java index 55d78c9..ef66382 100644 --- a/app/src/main/java/me/firesun/wechat/enhancement/plugin/LuckMoney.java +++ b/app/src/main/java/me/firesun/wechat/enhancement/plugin/LuckMoney.java @@ -69,7 +69,7 @@ protected void afterHookedMethod(MethodHookParam param) { handleTransfer(contentValues, lpparam); } } catch (Error | Exception e) { - log("error:"+e); + log("error:" + e); } } }); @@ -98,7 +98,7 @@ protected void beforeHookedMethod(MethodHookParam param) { luckyMoneyMessages.remove(0); } catch (Error | Exception e) { - log("error:"+e); + log("error:" + e); } } }); @@ -114,7 +114,7 @@ protected void afterHookedMethod(MethodHookParam param) { } } } catch (Error | Exception e) { - log("error:"+e); + log("error:" + e); } } }); @@ -131,7 +131,7 @@ protected void afterHookedMethod(MethodHookParam param) { Toast.makeText(activity, "微信ID:" + wechatId + "已复制到剪切板", LENGTH_LONG).show(); } } catch (Error | Exception e) { - log("error:"+e); + log("error:" + e); } } }); @@ -148,7 +148,7 @@ protected void afterHookedMethod(MethodHookParam param) { Toast.makeText(activity, "微信ID:" + wechatId + "已复制到剪切板", LENGTH_LONG).show(); } } catch (Error | Exception e) { - log("error:"+e); + log("error:" + e); } } }); diff --git a/app/src/main/java/me/firesun/wechat/enhancement/util/HookClasses.java b/app/src/main/java/me/firesun/wechat/enhancement/util/HookClasses.java index 535365b..4323e72 100644 --- a/app/src/main/java/me/firesun/wechat/enhancement/util/HookClasses.java +++ b/app/src/main/java/me/firesun/wechat/enhancement/util/HookClasses.java @@ -21,6 +21,7 @@ public class HookClasses { public static String SQLiteDatabaseDeleteMethod = "delete"; public static String ContactInfoUIClassName = "com.tencent.mm.plugin.profile.ui.ContactInfoUI"; public static String ChatroomInfoUIClassName = "com.tencent.mm.plugin.chatroom.ui.ChatroomInfoUI"; + public static String WebWXLoginUIClassName = "com.tencent.mm.plugin.webwx.ui.ExtDeviceWXLoginUI"; public static Class XMLParserClass; public static String XMLParserMethod; public static Class MsgInfoClass; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8fec307..b02dcdf 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -14,8 +14,9 @@ 红包设置 其他设置 防撤回设置 - 广告设置 + 增强功能 过滤朋友圈广告 + 电脑微信自动登录 消息防撤回 朋友圈防删除 显示图标 diff --git a/app/src/main/res/xml/pref_setting.xml b/app/src/main/res/xml/pref_setting.xml index d6123fe..b5b2da7 100644 --- a/app/src/main/res/xml/pref_setting.xml +++ b/app/src/main/res/xml/pref_setting.xml @@ -72,11 +72,15 @@ android:title="@string/pref_enable_anti_sns_delete" /> - + +