Skip to content

Commit 7978c14

Browse files
committed
Refactor HideReceipt to use dynamic message type index
Signed-off-by: Dev4Mod <[email protected]>
1 parent f211adf commit 7978c14

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,14 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
4545
var privacy = CustomPrivacy.getJSON(number);
4646
var customHideReceipt = privacy.optBoolean("HideReceipt", hideReceipt);
4747
var customHideRead = privacy.optBoolean("HideSeen", hideread);
48-
if (param.args[4] != "sender" && (customHideReceipt || ghostmode)) {
48+
var msgTypeIdx = ReflectionUtils.findIndexOfType(param.args, String.class);
49+
if (param.args[msgTypeIdx] != "sender" && (customHideReceipt || ghostmode)) {
4950
if (!ReflectionUtils.isCalledFromMethod(method2) && ReflectionUtils.isCalledFromMethod(mInChat) && !customHideRead) {
5051
return;
5152
}
52-
param.args[4] = "inactive";
53+
param.args[msgTypeIdx] = "inactive";
5354
}
54-
if (param.args[4] == "inactive") {
55+
if (param.args[msgTypeIdx] == "inactive") {
5556
Object fmessageObj = WppCore.getFMessageFromKey(key);
5657
var fmessage = new FMessageWpp(fmessageObj);
5758
var messageId = fmessage.getKey().messageID;

0 commit comments

Comments
 (0)