Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,14 @@ public synchronized static Method loadNewMessageMethod(ClassLoader loader) throw
var field = clazzMessage.getDeclaredField("A02");
methodData = clazzData.findMethod(new FindMethod().matcher(new MethodMatcher().addUsingField(DexSignUtil.getFieldDescriptor(field)).returnType(String.class)));
}
if (methodData.isEmpty()) {
var csClazzData = dexkit.findClass(FindClass.create().matcher(ClassMatcher.create().addUsingString("FMessageSystemScheduledCallStart/setData index out of bounds: "))).singleOrNull();
if (csClazzData != null) {
var csClazz = csClazzData.getInstance(loader);
var field = csClazz.getDeclaredField("A02");
methodData = clazzData.findMethod(new FindMethod().matcher(new MethodMatcher().addUsingField(DexSignUtil.getFieldDescriptor(field)).returnType(String.class)));
}
}
if (methodData.isEmpty()) throw new RuntimeException("NewMessage method not found");
return methodData.get(0).getMethodInstance(loader);
});
Expand Down Expand Up @@ -1013,7 +1021,8 @@ public synchronized static Method loadGetEditMessageMethod(ClassLoader loader) t
}

// 21.xx+ method (static)
if (Modifier.isStatic(invoke.getMethodInstance(loader).getModifiers()) && Objects.equals(invoke.getParamTypes().get(0), methodData.getParamTypes().get(0))) {
// 25.xx+ added additional type check
if (Modifier.isStatic(invoke.getMethodInstance(loader).getModifiers()) && Objects.equals(invoke.getParamTypes().get(0), methodData.getParamTypes().get(0)) && !Objects.equals(invoke.getParamTypes().get(0), invoke.getDeclaredClass())) {
return invoke.getMethodInstance(loader);
}
}
Expand Down Expand Up @@ -1549,20 +1558,24 @@ public synchronized static Method loadTextStatusComposer2(ClassLoader classLoade
addMethod(MethodMatcher.create().paramCount(1).addParamType(TextDataClass))
));
if (result.isEmpty()) {
result = dexkit.findClass(FindClass.create().matcher(
ClassMatcher.create().addUsingString("ViewOnce messages can not be forwarded").
addMethod(MethodMatcher.create().paramCount(1).addParamType(TextDataClass))
));
if (result.isEmpty()) {
throw new RuntimeException("TextStatusComposer2 class not found");
var tscClazzData = dexkit.getClassData("com.whatsapp.statuscomposer.composer.TextStatusComposerFragment");
if (tscClazzData != null) {
for (var method : tscClazzData.getMethods()) {
var tdMethod = method.getInvokes().stream().filter(m -> m.isMethod() && m.getParamCount() == 1 && m.getParamTypes().get(0).equals(dexkit.getClassData(TextDataClass))).findFirst();
if (tdMethod.isPresent()) {
return tdMethod.get().getMethodInstance(classLoader);
}
}
}

throw new RuntimeException("TextStatusComposer2 class not found 1");
}

var foundClass = result.get(0).getInstance(classLoader);
var resultMethod = ReflectionUtils.findMethodUsingFilter(foundClass, method -> method.getParameterCount() == 1 && method.getParameterTypes()[0] == TextDataClass);
if (resultMethod != null)
return resultMethod;
throw new RuntimeException("TextStatusComposer2 method not found");
throw new RuntimeException("TextStatusComposer2 method not found 2");
});
}

Expand Down
2 changes: 2 additions & 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.23.xx</item>
<item>2.24.24.xx</item>
<item>2.24.25.xx</item>
<item>2.24.26.xx</item>
</string-array>
<string-array name="supported_versions_business">
<item>2.24.20.xx</item>
Expand All @@ -128,6 +129,7 @@
<item>2.24.23.xx</item>
<item>2.24.24.xx</item>
<item>2.24.25.xx</item>
<item>2.24.26.xx</item>
</string-array>
<string-array name="image_picker">
<item>image/*</item>
Expand Down