Skip to content

Commit e641062

Browse files
committed
Refactor receipt method and update HideSeen strings
Signed-off-by: Dev4Mod <[email protected]>
1 parent 24cefea commit e641062

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,17 @@ public synchronized static Method loadGhostModeMethod(ClassLoader classLoader) t
205205

206206
public synchronized static Method loadReceiptMethod(ClassLoader classLoader) throws Exception {
207207
return UnobfuscatorCache.getInstance().getMethod(classLoader, () -> {
208-
Method[] methods = findAllMethodUsingStrings(classLoader, StringMatchType.Equals, "receipt");
209-
var deviceJidClass = XposedHelpers.findClass("com.whatsapp.jid.DeviceJid", classLoader);
210-
Method bestMethod = Arrays.stream(methods).filter(method -> method.getParameterTypes().length > 1 && method.getParameterTypes()[1] == deviceJidClass).findFirst().orElse(null);
211-
if (bestMethod == null) throw new Exception("Receipt method not found");
212-
return bestMethod;
208+
var methods = dexkit.findMethod(
209+
FindMethod.create()
210+
.matcher(MethodMatcher.create().addUsingString("receipt")
211+
.paramCount(2, 6)
212+
.paramTypes(null, "com.whatsapp.jid.DeviceJid", null, null, null, null)
213+
)
214+
);
215+
if (methods.isEmpty())
216+
throw new NoSuchMethodError("Receipt method not found");
217+
218+
return methods.get(0).getMethodInstance(classLoader);
213219
});
214220
}
215221

@@ -341,7 +347,7 @@ public synchronized static Method loadHideViewSendReadJob(ClassLoader classLoade
341347
public synchronized static Method loadHideViewInChatMethod(ClassLoader classLoader) throws Exception {
342348
return UnobfuscatorCache.getInstance().getMethod(classLoader, () -> {
343349
var strings = new String[]{
344-
"ReadReceipts/sendDeliveryReadReceipt", "ReadReceipts/acknowledgeMessageIfNeeded", "ReadReceipts/sendDeliveryReceiptIfNotRetry"
350+
"ReadReceipts/sendReceiptForIncomingMessage", "ReadReceipts/sendDeliveryReadReceipt", "ReadReceipts/acknowledgeMessageIfNeeded", "ReadReceipts/sendDeliveryReceiptIfNotRetry"
345351
};
346352
for (var s : strings) {
347353
var method = findFirstMethodUsingStrings(classLoader, StringMatchType.Contains, s);

0 commit comments

Comments
 (0)