Skip to content

Commit caf86ee

Browse files
committed
fix 19.xx support
1 parent bc09c58 commit caf86ee

File tree

3 files changed

+51
-9
lines changed

3 files changed

+51
-9
lines changed

app/src/main/java/com/wmods/wppenhacer/xposed/core/WppCore.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,11 @@ public synchronized static Class getDataUsageActivityClass(@NonNull ClassLoader
264264

265265
public synchronized static Class getTextStatusComposerFragmentClass(@NonNull ClassLoader loader) {
266266
Class oldClass = XposedHelpers.findClassIfExists("com.whatsapp.statuscomposer.composer.TextStatusComposerFragment", loader);
267+
if (oldClass == null) oldClass = XposedHelpers.findClassIfExists("com.whatsapp.status.composer.composer.TextStatusComposerFragment", loader);
267268

268269
return oldClass != null
269270
? oldClass
270-
: XposedHelpers.findClass("com.whatsapp.status.composer.composer.TextStatusComposerFragment", loader);
271+
: XposedHelpers.findClass("com.whatsapp.status.composer.TextStatusComposerFragment", loader);
271272
}
272273

273274
// public static Activity getActivityBySimpleName(String name) {

app/src/main/java/com/wmods/wppenhacer/xposed/core/devkit/Unobfuscator.java

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,16 @@ public synchronized static Method loadSendPresenceMethod(ClassLoader loader) thr
908908
return UnobfuscatorCache.getInstance().getMethod(loader, () -> {
909909
var methodData = dexkit.findMethod(FindMethod.create().matcher(MethodMatcher.create().addUsingString("app/send-presence-subscription jid=")));
910910
if (methodData.isEmpty()) throw new Exception("SendPresence method not found");
911-
var newMethod = methodData.get(0).getCallers().singleOrNull(method1 -> method1.getParamCount() == 4);
911+
var methodCallers = methodData.get(0).getCallers();
912+
if (methodCallers.isEmpty()) {
913+
var method = methodData.get(0);
914+
var superMethodInterfaces = method.getDeclaredClass().getInterfaces();
915+
if (superMethodInterfaces.isEmpty()) throw new Exception("SendPresence method interface list empty");
916+
var superMethod = superMethodInterfaces.get(0).findMethod(FindMethod.create().matcher(MethodMatcher.create().name(method.getName()))).firstOrNull();
917+
if (superMethod == null) throw new Exception("SendPresence method interface method not found");
918+
methodCallers = superMethod.getCallers();
919+
}
920+
var newMethod = methodCallers.firstOrNull(method1 -> method1.getParamCount() == 4);
912921
if (newMethod == null) throw new Exception("SendPresence method not found 2");
913922
return newMethod.getMethodInstance(loader);
914923
});
@@ -1658,21 +1667,53 @@ public synchronized static Method loadCopiedMessageMethod(ClassLoader classLoade
16581667
});
16591668
}
16601669

1661-
public synchronized static Method loadSenderPlayed(ClassLoader classLoader) throws Exception {
1662-
return UnobfuscatorCache.getInstance().getMethod(classLoader, () -> {
1670+
public synchronized static Class<?> loadSenderPlayedClass(ClassLoader classLoader) throws Exception {
1671+
return UnobfuscatorCache.getInstance().getClass(classLoader, () -> {
16631672
var clazz = findFirstClassUsingStrings(classLoader, StringMatchType.Contains, "sendmethods/sendClearDirty");
16641673
if (clazz == null) throw new RuntimeException("SenderPlayed class not found");
1674+
return clazz;
1675+
});
1676+
}
1677+
1678+
public synchronized static Method loadSenderPlayedMethod(ClassLoader classLoader) throws Exception {
1679+
return UnobfuscatorCache.getInstance().getMethod(classLoader, () -> {
1680+
var clazz = loadSenderPlayedClass(classLoader);
16651681
var fmessageClass = loadFMessageClass(classLoader);
1666-
var methodResult = ReflectionUtils.findMethodUsingFilter(clazz, method -> method.getParameterCount() == 1 && fmessageClass.isAssignableFrom(method.getParameterTypes()[0]));
1667-
if (methodResult == null) throw new RuntimeException("SenderPlayed method not found");
1682+
Method methodResult = null;
1683+
for (var method : clazz.getMethods()) {
1684+
if (method.getParameterCount() == 1 && fmessageClass.isAssignableFrom(method.getParameterTypes()[0])) {
1685+
methodResult = method;
1686+
break;
1687+
}
1688+
}
1689+
1690+
// 2.25.19.xx, they refactored the SenderPlayed class
1691+
if (methodResult == null) {
1692+
var method = findFirstMethodUsingStrings(classLoader, StringMatchType.Contains, "mediaHash and fileType not both present for upload URL generation");
1693+
if (method != null) {
1694+
var cMethods = dexkit.getMethodData(method).getInvokes();
1695+
Collections.reverse(cMethods);
1696+
for (var cmethod : cMethods) {
1697+
if (cmethod.isMethod() && cmethod.getParamCount() == 1) {
1698+
var cParamType = cmethod.getParamTypes().get(0).getInstance(classLoader);
1699+
if (fmessageClass.isAssignableFrom(cParamType)) {
1700+
methodResult = cmethod.getMethodInstance(classLoader);
1701+
break;
1702+
}
1703+
}
1704+
}
1705+
}
1706+
}
1707+
1708+
if (methodResult == null) throw new RuntimeException("SenderPlayed method not found 2");
16681709
return methodResult;
16691710
});
16701711
}
16711712

16721713
public synchronized static Method loadSenderPlayedBusiness(ClassLoader classLoader) throws Exception {
16731714
return UnobfuscatorCache.getInstance().getMethod(classLoader, () -> {
1674-
var loadSenderPlayed = loadSenderPlayed(classLoader);
1675-
var foundMethod = ReflectionUtils.findMethodUsingFilter(loadSenderPlayed.getDeclaringClass(), method -> method.getParameterCount() > 0 && method.getParameterTypes()[0] == Set.class);
1715+
var loadSenderPlayed = loadSenderPlayedClass(classLoader);
1716+
var foundMethod = ReflectionUtils.findMethodUsingFilter(loadSenderPlayed, method -> method.getParameterCount() > 0 && method.getParameterTypes()[0] == Set.class);
16761717
if (foundMethod == null)
16771718
throw new RuntimeException("SenderPlayedBusiness method not found");
16781719
return foundMethod;

app/src/main/java/com/wmods/wppenhacer/xposed/features/privacy/HideSeen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
134134
}
135135
});
136136

137-
var loadSenderPlayed = Unobfuscator.loadSenderPlayed(classLoader);
137+
var loadSenderPlayed = Unobfuscator.loadSenderPlayedMethod(classLoader);
138138
XposedBridge.hookMethod(loadSenderPlayed, new XC_MethodHook() {
139139
@Override
140140
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {

0 commit comments

Comments
 (0)