Skip to content

Commit e1799fe

Browse files
authored
Merge pull request #198 from frknkrc44/feat-var-fixes
feat: Add various fixes
2 parents 8aa6823 + be58207 commit e1799fe

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

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

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,14 @@ public synchronized static Method loadNewMessageMethod(ClassLoader loader) throw
967967
var field = clazzMessage.getDeclaredField("A02");
968968
methodData = clazzData.findMethod(new FindMethod().matcher(new MethodMatcher().addUsingField(DexSignUtil.getFieldDescriptor(field)).returnType(String.class)));
969969
}
970+
if (methodData.isEmpty()) {
971+
var csClazzData = dexkit.findClass(FindClass.create().matcher(ClassMatcher.create().addUsingString("FMessageSystemScheduledCallStart/setData index out of bounds: "))).singleOrNull();
972+
if (csClazzData != null) {
973+
var csClazz = csClazzData.getInstance(loader);
974+
var field = csClazz.getDeclaredField("A02");
975+
methodData = clazzData.findMethod(new FindMethod().matcher(new MethodMatcher().addUsingField(DexSignUtil.getFieldDescriptor(field)).returnType(String.class)));
976+
}
977+
}
970978
if (methodData.isEmpty()) throw new RuntimeException("NewMessage method not found");
971979
return methodData.get(0).getMethodInstance(loader);
972980
});
@@ -1013,7 +1021,8 @@ public synchronized static Method loadGetEditMessageMethod(ClassLoader loader) t
10131021
}
10141022

10151023
// 21.xx+ method (static)
1016-
if (Modifier.isStatic(invoke.getMethodInstance(loader).getModifiers()) && Objects.equals(invoke.getParamTypes().get(0), methodData.getParamTypes().get(0))) {
1024+
// 25.xx+ added additional type check
1025+
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())) {
10171026
return invoke.getMethodInstance(loader);
10181027
}
10191028
}
@@ -1549,20 +1558,24 @@ public synchronized static Method loadTextStatusComposer2(ClassLoader classLoade
15491558
addMethod(MethodMatcher.create().paramCount(1).addParamType(TextDataClass))
15501559
));
15511560
if (result.isEmpty()) {
1552-
result = dexkit.findClass(FindClass.create().matcher(
1553-
ClassMatcher.create().addUsingString("ViewOnce messages can not be forwarded").
1554-
addMethod(MethodMatcher.create().paramCount(1).addParamType(TextDataClass))
1555-
));
1556-
if (result.isEmpty()) {
1557-
throw new RuntimeException("TextStatusComposer2 class not found");
1561+
var tscClazzData = dexkit.getClassData("com.whatsapp.statuscomposer.composer.TextStatusComposerFragment");
1562+
if (tscClazzData != null) {
1563+
for (var method : tscClazzData.getMethods()) {
1564+
var tdMethod = method.getInvokes().stream().filter(m -> m.isMethod() && m.getParamCount() == 1 && m.getParamTypes().get(0).equals(dexkit.getClassData(TextDataClass))).findFirst();
1565+
if (tdMethod.isPresent()) {
1566+
return tdMethod.get().getMethodInstance(classLoader);
1567+
}
1568+
}
15581569
}
1570+
1571+
throw new RuntimeException("TextStatusComposer2 class not found 1");
15591572
}
15601573

15611574
var foundClass = result.get(0).getInstance(classLoader);
15621575
var resultMethod = ReflectionUtils.findMethodUsingFilter(foundClass, method -> method.getParameterCount() == 1 && method.getParameterTypes()[0] == TextDataClass);
15631576
if (resultMethod != null)
15641577
return resultMethod;
1565-
throw new RuntimeException("TextStatusComposer2 method not found");
1578+
throw new RuntimeException("TextStatusComposer2 method not found 2");
15661579
});
15671580
}
15681581

app/src/main/res/values/arrays.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
<item>2.24.23.xx</item>
121121
<item>2.24.24.xx</item>
122122
<item>2.24.25.xx</item>
123+
<item>2.24.26.xx</item>
123124
</string-array>
124125
<string-array name="supported_versions_business">
125126
<item>2.24.20.xx</item>
@@ -128,6 +129,7 @@
128129
<item>2.24.23.xx</item>
129130
<item>2.24.24.xx</item>
130131
<item>2.24.25.xx</item>
132+
<item>2.24.26.xx</item>
131133
</string-array>
132134
<string-array name="image_picker">
133135
<item>image/*</item>

0 commit comments

Comments
 (0)