Skip to content

Commit 7b3ad14

Browse files
committed
提高微信多版本兼容性
1 parent 07b68fe commit 7b3ad14

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
applicationId "com.surcumference.fingerprintpay"
1111
minSdkVersion 14
1212
targetSdkVersion 26
13-
versionCode 18
14-
versionName "3.5.0"
13+
versionCode 19
14+
versionName "3.6.0"
1515
buildConfigField "String", "APP_PRODUCT_NAME", "\"WeChatFp\""
1616
}
1717

app/src/main/java/com/yyxx/wechatfp/xposed/plugin/XposedWeChatPlugin.java

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949

5050
import java.lang.reflect.Field;
5151
import java.util.ArrayList;
52+
import java.util.Arrays;
5253
import java.util.List;
5354

5455
import de.robv.android.xposed.XC_MethodHook;
@@ -106,14 +107,8 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
106107
XposedHelpers.findAndHookMethod(Dialog.class, "show", new XC_MethodHook() {
107108
@TargetApi(21)
108109
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
109-
if (mWeChatVersionCode >= 1240) { // WECHAT 6.6.2
110-
if (!"com.tencent.mm.plugin.wallet_core.ui.m".equals(param.thisObject.getClass().getName())) {
111-
return;
112-
}
113-
} else {
114-
if (!"com.tencent.mm.plugin.wallet_core.ui.l".equals(param.thisObject.getClass().getName())) {
115-
return;
116-
}
110+
if (!verifyPayDialog(param.thisObject.getClass())) {
111+
return;
117112
}
118113
L.d("PayDialog Constructor", param.thisObject);
119114
if (Config.from(context).isOn()) {
@@ -513,4 +508,25 @@ private static int getWeChatVersionCode(Context context) {
513508
}
514509
return 0;
515510
}
511+
512+
private static boolean verifyPayDialog(Class targetClass) {
513+
if (!targetClass.getName().startsWith("com.tencent.mm.plugin.wallet_core.ui.")) {
514+
return false;
515+
}
516+
String method = Arrays.toString(targetClass.getDeclaredMethods());
517+
if (!method.contains("Bankcard")) {
518+
return false;
519+
}
520+
String field = Arrays.toString(targetClass.getDeclaredFields());
521+
if (!field.contains("MyKeyboardWindow")) {
522+
return false;
523+
}
524+
if (!field.contains("EditHintPasswdView")) {
525+
return false;
526+
}
527+
if (!field.contains("Bankcard")) {
528+
return false;
529+
}
530+
return true;
531+
}
516532
}

0 commit comments

Comments
 (0)