Skip to content

Commit ece72cd

Browse files
authored
Merge pull request #369 from frknkrc44/fix-18xx-19xx
initial support for 18.xx and 19.xx
2 parents c88484b + c1aa0b0 commit ece72cd

File tree

5 files changed

+76
-11
lines changed

5 files changed

+76
-11
lines changed

.idea/misc.xml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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: 69 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public synchronized static Method loadReceiptOutsideChat(ClassLoader classLoader
215215
public synchronized static Method loadReceiptInChat(ClassLoader classLoader) throws Exception {
216216
return UnobfuscatorCache.getInstance().getMethod(classLoader, () -> {
217217
var method = loadReceiptMethod(classLoader);
218-
var methodDataList = dexkit.findMethod(new FindMethod().matcher(new MethodMatcher().addUsingString("callCreatorJid").addUsingString("reject").addUsingNumber(6175).addInvoke(DexSignUtil.getMethodDescriptor(method))));
218+
var methodDataList = dexkit.findMethod(new FindMethod().matcher(new MethodMatcher().addUsingString("callCreatorJid").addUsingString("reject").addInvoke(DexSignUtil.getMethodDescriptor(method))));
219219
if (methodDataList.isEmpty()) throw new Exception("Receipt method not found");
220220
return methodDataList.get(0).getMethodInstance(classLoader);
221221
});
@@ -249,6 +249,25 @@ public synchronized static Field loadBroadcastTagField(ClassLoader classLoader)
249249
var clazzData = dexkit.findClass(FindClass.create().matcher(ClassMatcher.create().addUsingString("UPDATE_MESSAGE_MAIN_BROADCAST_SCAN_SQL")));
250250
if (clazzData.isEmpty()) throw new Exception("BroadcastTag class not found");
251251
var methodData = dexkit.findMethod(FindMethod.create().searchInClass(clazzData).matcher(MethodMatcher.create().usingStrings("participant_hash", "view_mode", "broadcast")));
252+
253+
// 2.25.18.xx, they splitted method and moved to the fmessage
254+
if (methodData.isEmpty()) {
255+
methodData = dexkit.findMethod(FindMethod.create().searchInClass(clazzData).matcher(MethodMatcher.create().usingStrings("received_timestamp", "view_mode", "message")));
256+
if (!methodData.isEmpty()) {
257+
var calledMethods = methodData.get(0).getInvokes();
258+
for (var cmethod : calledMethods) {
259+
if (Modifier.isStatic(cmethod.getModifiers()) && cmethod.getParamCount() == 2 && fmessage.getName().equals(cmethod.getDeclaredClass().getName())) {
260+
var pTypes = cmethod.getParamTypes();
261+
if (pTypes.get(0).getName().equals(ContentValues.class.getName()) && pTypes.get(1).getName().equals(fmessage.getName())) {
262+
methodData.clear();
263+
methodData.add(cmethod);
264+
break;
265+
}
266+
}
267+
}
268+
}
269+
}
270+
252271
if (methodData.isEmpty()) throw new Exception("BroadcastTag method support not found");
253272
var usingFields = methodData.get(0).getUsingFields();
254273
for (var ufield : usingFields) {
@@ -813,6 +832,7 @@ public synchronized static Method loadBlueOnReplayWaJobManagerMethod(ClassLoader
813832
public synchronized static Class loadArchiveChatClass(ClassLoader loader) throws Exception {
814833
return UnobfuscatorCache.getInstance().getClass(loader, () -> {
815834
var clazz = findFirstClassUsingStrings(loader, StringMatchType.Contains, "archive/set-content-indicator-to-empty");
835+
if (clazz == null) clazz = findFirstClassUsingStrings(loader, StringMatchType.Contains, "archive/Unsupported mode in ArchivePreviewView:");
816836
if (clazz == null) throw new Exception("ArchiveHideView method not found");
817837
return clazz;
818838
});
@@ -887,7 +907,16 @@ public synchronized static Method loadSendPresenceMethod(ClassLoader loader) thr
887907
return UnobfuscatorCache.getInstance().getMethod(loader, () -> {
888908
var methodData = dexkit.findMethod(FindMethod.create().matcher(MethodMatcher.create().addUsingString("app/send-presence-subscription jid=")));
889909
if (methodData.isEmpty()) throw new Exception("SendPresence method not found");
890-
var newMethod = methodData.get(0).getCallers().singleOrNull(method1 -> method1.getParamCount() == 4);
910+
var methodCallers = methodData.get(0).getCallers();
911+
if (methodCallers.isEmpty()) {
912+
var method = methodData.get(0);
913+
var superMethodInterfaces = method.getDeclaredClass().getInterfaces();
914+
if (superMethodInterfaces.isEmpty()) throw new Exception("SendPresence method interface list empty");
915+
var superMethod = superMethodInterfaces.get(0).findMethod(FindMethod.create().matcher(MethodMatcher.create().name(method.getName()))).firstOrNull();
916+
if (superMethod == null) throw new Exception("SendPresence method interface method not found");
917+
methodCallers = superMethod.getCallers();
918+
}
919+
var newMethod = methodCallers.firstOrNull(method1 -> method1.getParamCount() == 4);
891920
if (newMethod == null) throw new Exception("SendPresence method not found 2");
892921
return newMethod.getMethodInstance(loader);
893922
});
@@ -1637,21 +1666,53 @@ public synchronized static Method loadCopiedMessageMethod(ClassLoader classLoade
16371666
});
16381667
}
16391668

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

16511712
public synchronized static Method loadSenderPlayedBusiness(ClassLoader classLoader) throws Exception {
16521713
return UnobfuscatorCache.getInstance().getMethod(classLoader, () -> {
1653-
var loadSenderPlayed = loadSenderPlayed(classLoader);
1654-
var foundMethod = ReflectionUtils.findMethodUsingFilter(loadSenderPlayed.getDeclaringClass(), method -> method.getParameterCount() > 0 && method.getParameterTypes()[0] == Set.class);
1714+
var loadSenderPlayed = loadSenderPlayedClass(classLoader);
1715+
var foundMethod = ReflectionUtils.findMethodUsingFilter(loadSenderPlayed, method -> method.getParameterCount() > 0 && method.getParameterTypes()[0] == Set.class);
16551716
if (foundMethod == null)
16561717
throw new RuntimeException("SenderPlayedBusiness method not found");
16571718
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 {

app/src/main/res/values/arrays.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@
126126
<item>2.25.15.xx</item>
127127
<item>2.25.16.xx</item>
128128
<item>2.25.17.xx</item>
129+
<item>2.25.18.xx</item>
130+
<item>2.25.19.xx</item>
129131
</string-array>
130132
<string-array name="supported_versions_business">
131133
<item>2.25.11.xx</item>
@@ -135,6 +137,8 @@
135137
<item>2.25.15.xx</item>
136138
<item>2.25.16.xx</item>
137139
<item>2.25.17.xx</item>
140+
<item>2.25.18.xx</item>
141+
<item>2.25.19.xx</item>
138142
</string-array>
139143
<string-array name="image_picker">
140144
<item>image/*</item>

0 commit comments

Comments
 (0)