|
19 | 19 | import androidx.annotation.Nullable; |
20 | 20 |
|
21 | 21 | import com.wmods.wppenhacer.xposed.core.WppCore; |
| 22 | +import com.wmods.wppenhacer.xposed.core.components.FMessageWpp; |
22 | 23 | import com.wmods.wppenhacer.xposed.utils.ReflectionUtils; |
23 | 24 | import com.wmods.wppenhacer.xposed.utils.Utils; |
24 | 25 |
|
@@ -395,54 +396,6 @@ public synchronized static Method loadIconTabMethod(ClassLoader classLoader) thr |
395 | 396 | }); |
396 | 397 | } |
397 | 398 |
|
398 | | - public synchronized static Field loadPreIconTabField(ClassLoader classLoader) throws Exception { |
399 | | - return UnobfuscatorCache.getInstance().getField(classLoader, () -> { |
400 | | - Class<?> cls = loadIconTabMethod(classLoader).getDeclaringClass(); |
401 | | - Class<?> clsType = findFirstClassUsingStringsFilter(classLoader, "X.", StringMatchType.Contains, "Tried to set badge"); |
402 | | - if (clsType == null) throw new Exception("PreIconTabField not found"); |
403 | | - Field result = null; |
404 | | - for (var field1 : cls.getFields()) { |
405 | | - Object checkResult = Arrays.stream(field1.getType().getFields()).filter(f -> f.getType().equals(clsType)).findFirst().orElse(null); |
406 | | - if (checkResult != null) { |
407 | | - result = field1; |
408 | | - break; |
409 | | - } |
410 | | - } |
411 | | - if (result == null) throw new Exception("PreIconTabField not found 2"); |
412 | | - return result; |
413 | | - }); |
414 | | - } |
415 | | - |
416 | | - public synchronized static Field loadIconTabField(ClassLoader classLoader) throws Exception { |
417 | | - return UnobfuscatorCache.getInstance().getField(classLoader, () -> { |
418 | | - Class<?> cls = loadIconTabMethod(classLoader).getDeclaringClass(); |
419 | | - Class<?> clsType = findFirstClassUsingStringsFilter(classLoader, "X.", StringMatchType.Contains, "Tried to set badge"); |
420 | | - if (clsType == null) throw new Exception("IconTabField not found"); |
421 | | - for (var field1 : cls.getFields()) { |
422 | | - var result = Arrays.stream(field1.getType().getFields()).filter(f -> f.getType().equals(clsType)).findFirst().orElse(null); |
423 | | - if (result != null) return result; |
424 | | - } |
425 | | - throw new Exception("IconTabField not found 2"); |
426 | | - }); |
427 | | - } |
428 | | - |
429 | | - public synchronized static Field loadIconTabLayoutField(ClassLoader classLoader) throws Exception { |
430 | | - return UnobfuscatorCache.getInstance().getField(classLoader, () -> { |
431 | | - Class<?> clsType = loadIconTabField(classLoader).getType(); |
432 | | - Class<?> framelayout = findFirstClassUsingStringsFilter(classLoader, "X.", StringMatchType.Contains, "android:menu:presenters"); |
433 | | - var result = Arrays.stream(clsType.getFields()).filter(f -> f.getType().equals(framelayout)).findFirst().orElse(null); |
434 | | - if (result == null) throw new Exception("IconTabLayoutField not found"); |
435 | | - return result; |
436 | | - }); |
437 | | - } |
438 | | - |
439 | | - public synchronized static Field loadIconMenuField(ClassLoader classLoader) throws Exception { |
440 | | - return UnobfuscatorCache.getInstance().getField(classLoader, () -> { |
441 | | - Class<?> clsType = loadIconTabLayoutField(classLoader).getType(); |
442 | | - Class<?> menuClass = findFirstClassUsingStringsFilter(classLoader, "X.", StringMatchType.Contains, "Maximum number of items"); |
443 | | - return Arrays.stream(clsType.getFields()).filter(f -> f.getType().equals(menuClass)).findFirst().orElse(null); |
444 | | - }); |
445 | | - } |
446 | 399 |
|
447 | 400 | public synchronized static Method loadTabCountMethod(ClassLoader classLoader) throws Exception { |
448 | 401 | return UnobfuscatorCache.getInstance().getMethod(classLoader, () -> { |
@@ -1482,7 +1435,7 @@ public synchronized static Class getFilterView(ClassLoader loader) throws Except |
1482 | 1435 |
|
1483 | 1436 | public synchronized static Class loadActionUser(ClassLoader loader) throws Exception { |
1484 | 1437 | return UnobfuscatorCache.getInstance().getClass(loader, () -> { |
1485 | | - for (String s : List.of("UserActions/userActionDeleteMessages", "UserActions/reportIfBadTime: time=", "UserActions/createFMessageTextFromUserInputs", "UserActions/userActionKeepInChat", "UserActions/userActionSendMediaMessages")) { |
| 1438 | + for (String s : List.of("UserActions/userActionDeleteMessages", "UserActions/reportIfBadTime: time=", "UserActions/createFMessageTextFromUserInputs", "UserActions/userActionKeepInChat", "UserActions/userActionSendMediaMessages", "UserActions/userActionForwardMessage")) { |
1486 | 1439 | var clazz = findFirstClassUsingStrings(loader, StringMatchType.Contains, s); |
1487 | 1440 | if (clazz != null) |
1488 | 1441 | return clazz; |
@@ -1867,11 +1820,15 @@ public static synchronized Class loadCachedMessageStore(ClassLoader loader) thro |
1867 | 1820 |
|
1868 | 1821 | public static synchronized Class loadAbstractMediaMessageClass(ClassLoader loader) throws Exception { |
1869 | 1822 | return UnobfuscatorCache.getInstance().getClass(loader, () -> { |
1870 | | - var fmessage = loadFMessageClass(loader); |
1871 | | - var classList = dexkit.findClass(FindClass.create().matcher(ClassMatcher.create().addUsingString("first_viewed_timestamp").superClass(fmessage.getName()))); |
1872 | | - if (classList.isEmpty()) |
1873 | | - throw new RuntimeException("AbstractMediaMessage class not found"); |
1874 | | - return classList.get(0).getInstance(loader); |
| 1823 | + for (var str : List.of("first_viewed_timestamp", "Field is set but is null in MediaDataV2")) { |
| 1824 | + var classList = dexkit.findClass(FindClass.create().matcher(ClassMatcher.create().addUsingString(str))); |
| 1825 | + for (var clazz : classList) { |
| 1826 | + var clazzInstance = clazz.getInstance(loader); |
| 1827 | + if (FMessageWpp.checkUnsafeIsFMessage(loader, clazzInstance)) |
| 1828 | + return clazzInstance; |
| 1829 | + } |
| 1830 | + } |
| 1831 | + throw new ClassNotFoundException("AbstractMediaMessage Not Found"); |
1875 | 1832 | }); |
1876 | 1833 | } |
1877 | 1834 |
|
@@ -2053,4 +2010,8 @@ public static Method loadAddOptionSearchBarMethod(ClassLoader classLoader) throw |
2053 | 2010 | return methodData.get(0).getMethodInstance(classLoader); |
2054 | 2011 | }); |
2055 | 2012 | } |
| 2013 | + |
| 2014 | + public static Method loadAddMenuAndroidX(ClassLoader classLoader) throws Exception { |
| 2015 | + return UnobfuscatorCache.getInstance().getMethod(classLoader, () -> findFirstMethodUsingStrings(classLoader, StringMatchType.Contains, "Maximum number of items supported by")); |
| 2016 | + } |
2056 | 2017 | } |
0 commit comments