Skip to content

Commit 4e05ace

Browse files
authored
Merge pull request #257 from frknkrc44/fix-25-4
add 25.4.xx stable support
2 parents 4008104 + 57f1add commit 4e05ace

File tree

3 files changed

+33
-9
lines changed

3 files changed

+33
-9
lines changed

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

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.luckypray.dexkit.query.enums.StringMatchType;
2525
import org.luckypray.dexkit.query.matchers.ClassMatcher;
2626
import org.luckypray.dexkit.query.matchers.MethodMatcher;
27+
import org.luckypray.dexkit.query.matchers.MethodsMatcher;
2728
import org.luckypray.dexkit.query.matchers.base.OpCodesMatcher;
2829
import org.luckypray.dexkit.result.ClassData;
2930
import org.luckypray.dexkit.result.ClassDataList;
@@ -763,12 +764,20 @@ public synchronized static Field loadStatusPlaybackViewField(ClassLoader loader)
763764
ClassMatcher.create().methodCount(1).addFieldForType(class1)
764765
));
765766
if (classView.isEmpty()) classView = dexkit.findClass(FindClass.create().matcher(
766-
ClassMatcher.create().methodCount(1, 2)
767-
.addMethod(MethodMatcher.create().paramTypes(View.class, boolean.class, boolean.class))
767+
ClassMatcher.create()
768+
.addMethod(MethodMatcher.create().invokeMethods(
769+
MethodsMatcher.create().methods(
770+
Collections.singletonList(
771+
MethodMatcher.create().declaredClass(ClassMatcher.create().addUsingString("INVOKE_RETURN"))
772+
.paramTypes(View.class, int.class)
773+
)
774+
)
775+
))
768776
.addFieldForType(class1)
769777
));
770778
if (classView.isEmpty()) throw new Exception("StatusPlaybackView field not found");
771-
Class<?> clsViewStatus = classView.get(0).getInstance(loader);
779+
Class<?> clsViewStatus = classView.single(classData -> classData.getSuperClass().getSimpleName().equals("Object")).getInstance(loader);
780+
if (classView.isEmpty()) throw new Exception("StatusPlaybackView field not found 2");
772781
Class<?> class2 = XposedHelpers.findClass("com.whatsapp.status.playback.fragment.StatusPlaybackBaseFragment", loader);
773782
return Arrays.stream(class2.getDeclaredFields()).filter(f -> f.getType() == clsViewStatus).findFirst().orElse(null);
774783
});
@@ -1585,10 +1594,22 @@ public synchronized static Class loadListChannelItemClass(ClassLoader classLoade
15851594
}
15861595

15871596
public synchronized static Method loadTextStatusComposer(ClassLoader classLoader) throws Exception {
1588-
var methods = dexkit.findMethod(FindMethod.create().matcher(MethodMatcher.create().addUsingString("background_color_key", StringMatchType.Equals).paramCount(1)));
1589-
if (methods.isEmpty())
1590-
return null;
1591-
return methods.single().getMethodInstance(classLoader);
1597+
return UnobfuscatorCache.getInstance().getMethod(classLoader, () -> {
1598+
var methods = dexkit.findMethod(FindMethod.create().matcher(MethodMatcher.create().addUsingString("background_color_key", StringMatchType.Equals)));
1599+
for (MethodData method : methods) {
1600+
var targetMethod = method.getDeclaredClass().findMethod(
1601+
FindMethod.create().matcher(
1602+
MethodMatcher.create().returnType(int.class).paramCount(1)
1603+
)
1604+
);
1605+
1606+
if (!targetMethod.isEmpty()) {
1607+
return targetMethod.single().getMethodInstance(classLoader);
1608+
}
1609+
}
1610+
1611+
throw new RuntimeException("TextStatusComposer class not found");
1612+
});
15921613
}
15931614

15941615
public synchronized static Method loadTextStatusComposer2(ClassLoader classLoader) throws Exception {

app/src/main/java/com/wmods/wppenhacer/xposed/features/others/ToastViewer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ public void doHook() throws Throwable {
4747
XposedBridge.hookMethod(onInsertReceipt, new XC_MethodHook() {
4848
@Override
4949
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
50-
var type = (int) param.args[1];
51-
var id = (long) param.args[2];
50+
var param1IsInt = param.args[1] instanceof Integer; // true if WA < 25.4
51+
var type = (int) param.args[param1IsInt ? 1 : 2];
52+
var id = (long) param.args[param1IsInt ? 2 : 3];
5253
if (type != 13) return;
5354
var PhoneUserJid = param.args[0];
5455
CompletableFuture.runAsync(() -> {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,13 @@
117117
<item>2.25.1.xx</item>
118118
<item>2.25.2.xx</item>
119119
<item>2.25.3.xx</item>
120+
<item>2.25.4.xx</item>
120121
</string-array>
121122
<string-array name="supported_versions_business">
122123
<item>2.25.1.xx</item>
123124
<item>2.25.2.xx</item>
124125
<item>2.25.3.xx</item>
126+
<item>2.25.4.xx</item>
125127
</string-array>
126128
<string-array name="image_picker">
127129
<item>image/*</item>

0 commit comments

Comments
 (0)