|
38 | 38 | import java.util.ArrayList; |
39 | 39 | import java.util.Arrays; |
40 | 40 | import java.util.Calendar; |
| 41 | +import java.util.Collections; |
41 | 42 | import java.util.Date; |
42 | 43 | import java.util.HashMap; |
43 | 44 | import java.util.List; |
@@ -835,6 +836,19 @@ public synchronized static Method loadSendPresenceMethod(ClassLoader loader) thr |
835 | 836 | return UnobfuscatorCache.getInstance().getMethod(loader, () -> { |
836 | 837 | var method = findFirstMethodUsingStrings(loader, StringMatchType.Contains, "app/send-presence-subscription jid="); |
837 | 838 | if (method == null) throw new Exception("SendPresence method not found"); |
| 839 | + |
| 840 | + // for 22.xx, method returns wrong one |
| 841 | + var methodData = dexkit.getMethodData(method); |
| 842 | + var groupJidClass = XposedHelpers.findClass("com.whatsapp.jid.GroupJid", loader); |
| 843 | + var classCheckMethod = dexkit.findMethod(FindMethod.create() |
| 844 | + .searchInClass(Collections.singletonList(methodData.getDeclaredClass())) |
| 845 | + .matcher(MethodMatcher.create().returnType(groupJidClass))) |
| 846 | + .singleOrNull(); |
| 847 | + if (classCheckMethod == null) { |
| 848 | + var newMethod = methodData.getCallers().firstOrNull(); |
| 849 | + if (newMethod == null) throw new Exception("SendPresence method not found 2"); |
| 850 | + return newMethod.getMethodInstance(loader); |
| 851 | + } |
838 | 852 | return method; |
839 | 853 | }); |
840 | 854 | } |
@@ -1211,6 +1225,11 @@ public synchronized static Method loadMaterialAlertDialog(ClassLoader loader) th |
1211 | 1225 | if (invoke.isMethod() && Modifier.isStatic(invoke.getModifiers()) && invoke.getParamCount() == 1 && invoke.getParamTypes().get(0).getName().equals(Context.class.getName())) { |
1212 | 1226 | return invoke.getMethodInstance(loader); |
1213 | 1227 | } |
| 1228 | + |
| 1229 | + // for 22.xx, MaterialAlertDialog method is not static |
| 1230 | + if (invoke.isMethod() && invoke.getParamCount() == 1 && invoke.getParamTypes().get(0).getName().equals(Context.class.getName())) { |
| 1231 | + return invoke.getMethodInstance(loader); |
| 1232 | + } |
1214 | 1233 | } |
1215 | 1234 | throw new RuntimeException("MaterialAlertDialog not found"); |
1216 | 1235 | }); |
@@ -1477,8 +1496,13 @@ public synchronized static Method loadPlaybackSpeed(ClassLoader classLoader) thr |
1477 | 1496 | public synchronized static Constructor loadListUpdateItemsConstructor(ClassLoader classLoader) throws Exception { |
1478 | 1497 | return UnobfuscatorCache.getInstance().getConstructor(classLoader, () -> { |
1479 | 1498 | var method = dexkit.findMethod(new FindMethod().matcher(new MethodMatcher().paramCount(1).returnType(void.class).addParamType(Object.class).addUsingNumber(8686))); |
1480 | | - if (method.isEmpty()) |
1481 | | - throw new RuntimeException("ListUpdateItems method not found"); |
| 1499 | + if (method.isEmpty()) { |
| 1500 | + // for 22.xx, use alternative method |
| 1501 | + method = dexkit.findMethod(new FindMethod().matcher(new MethodMatcher().paramCount(1).returnType(void.class).addUsingString("deleted", StringMatchType.Equals).addUsingString("membership", StringMatchType.Equals))); |
| 1502 | + |
| 1503 | + if (method.isEmpty()) |
| 1504 | + throw new RuntimeException("ListUpdateItems method not found"); |
| 1505 | + } |
1482 | 1506 | return method.get(0).getClassInstance(classLoader).getConstructors()[0]; |
1483 | 1507 | }); |
1484 | 1508 | } |
|
0 commit comments