Skip to content

Commit

Permalink
Merge pull request #115 from frknkrc44/master
Browse files Browse the repository at this point in the history
feat: Add 2.24.18.xx support
  • Loading branch information
Dev4Mod authored Sep 14, 2024
2 parents 2ec6a83 + 6badeab commit 66d1684
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ public synchronized static Method loadForwardTagMethod(ClassLoader classLoader)
for (var invoke : invokes) {
var method = invoke.getMethodInstance(classLoader);
if (method.getParameterCount() == 1
&& method.getParameterTypes()[0] == int.class
&& (method.getParameterTypes()[0] == int.class
|| method.getParameterTypes()[0] == long.class)
&& method.getDeclaringClass() == messageInfoClass
&& method.getReturnType() == void.class) {
return method;
Expand Down Expand Up @@ -278,7 +279,7 @@ public synchronized static Method loadTabListMethod(ClassLoader classLoader) thr

public synchronized static Method loadGetTabMethod(ClassLoader classLoader) throws Exception {
return UnobfuscatorCache.getInstance().getMethod(classLoader, () -> {
Method result = findFirstMethodUsingStringsFilter(classLoader, "X.", StringMatchType.Contains, "Invalid tab id: 600");
Method result = findFirstMethodUsingStringsFilter(classLoader, "X.", StringMatchType.Contains, "No HomeFragment mapping for community tab id:");
if (result == null) throw new Exception("GetTab method not found");
return result;
});
Expand Down Expand Up @@ -498,7 +499,7 @@ public synchronized static Method loadStatusActivePage(ClassLoader classLoader)

public synchronized static Class<?> loadStatusDownloadMediaClass(ClassLoader classLoader) throws Exception {
return UnobfuscatorCache.getInstance().getClass(classLoader, () -> {
var clazz = findFirstClassUsingStrings(classLoader, StringMatchType.Contains, "FMessageVideo/Cloned");
var clazz = findFirstClassUsingStrings(classLoader, StringMatchType.Contains, "static.whatsapp.net/downloadable?category=PSA");
if (clazz == null) throw new Exception("StatusDownloadMedia class not found");
return clazz;
});
Expand Down Expand Up @@ -1428,8 +1429,15 @@ public synchronized static Field loadOriginFMessageField(ClassLoader classLoader

public synchronized static Method loadForwardAudioTypeMethod(ClassLoader classLoader) throws Exception {
return UnobfuscatorCache.getInstance().getMethod(classLoader, () -> {
var result = findFirstMethodUsingStrings(classLoader, StringMatchType.Contains, "forwardable", "FMessageFactory/newFMessageForForward/thumbnail");
if (result == null) throw new RuntimeException("ForwardAudioType method not found");
var results = findAllMethodUsingStrings(classLoader, StringMatchType.Contains, "FMessageFactory/newFMessageForForward/thumbnail");
if (results == null || results.length < 1) throw new RuntimeException("ForwardAudioType method not found");
Method result;
if (results.length > 1) {
result = findFirstMethodUsingStrings(classLoader, StringMatchType.Contains, "forwardable", "FMessageFactory/newFMessageForForward/thumbnail");
} else {
// 2.24.18.xx returns one method
result = results[0];
}
return result;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void doHook() throws Exception {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (!prefs.getBoolean("hidetag", false)) return;
var arg = (int) param.args[0];
var arg = (long) param.args[0];
if (arg == 1) {
if (ReflectionUtils.isCalledFromClass(forwardClass)) {
param.args[0] = 0;
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
<item>2.24.15.xx</item>
<item>2.24.16.xx</item>
<item>2.24.17.xx</item>
<item>2.24.18.xx</item>
</string-array>
<string-array name="supported_versions_business">
<item>2.24.12.xx</item>
Expand Down

0 comments on commit 66d1684

Please sign in to comment.