Skip to content

Commit

Permalink
Fix bug in hide receipt (second tick)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev4Mod committed May 14, 2024
1 parent bc9a993 commit 499adf5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,17 @@ public static Method loadReceiptMethod2(ClassLoader classLoader) throws Exceptio
});
}

public static Method loadReceiptMethod3(ClassLoader classLoader) throws Exception {
return UnobfuscatorCache.getInstance().getMethod(classLoader, () -> {
var method = loadReceiptMethod(classLoader);
var classList = dexkit.findClass(new FindClass().matcher(new ClassMatcher().addUsingString("callCreatorJid")));
if (classList.isEmpty()) throw new Exception("Receipt method not found");
var methodDataList = dexkit.findMethod(new FindMethod().searchInClass(classList).matcher(new MethodMatcher().addInvoke(DexSignUtil.getMethodDescriptor(method))));
if (methodDataList.isEmpty()) throw new Exception("Receipt method not found");
return methodDataList.get(0).getMethodInstance(classLoader);
});
}

// TODO: Classes and Methods for HideForward

public static Method loadForwardTagMethod(ClassLoader classLoader) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ public HideReceipt(ClassLoader loader, XSharedPreferences preferences) {
public void doHook() throws Exception {
var method = Unobfuscator.loadReceiptMethod(loader);
var method2 = Unobfuscator.loadReceiptMethod2(loader);
var method3 = Unobfuscator.loadReceiptMethod3(loader);
logDebug(Unobfuscator.getMethodDescriptor(method));
XposedBridge.hookMethod(method, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (!prefs.getBoolean("hidereceipt", false)) return;
if (!Unobfuscator.isCalledFromMethod(method2)) return;
if (!Unobfuscator.isCalledFromMethod(method2) && !Unobfuscator.isCalledFromMethod(method3)) return;
var jid = WppCore.getRawString(param.args[0]);
if ((jid == null || jid.contains("@lid")) && param.args[4] != "sender") {
param.args[4] = "inactive";
Expand Down

0 comments on commit 499adf5

Please sign in to comment.