@@ -150,12 +150,6 @@ public synchronized static String getMethodDescriptor(Method method) {
150150 return method .getDeclaringClass ().getName () + "->" + method .getName () + "(" + Arrays .stream (method .getParameterTypes ()).map (Class ::getName ).collect (Collectors .joining ("," )) + ")" ;
151151 }
152152
153-
154- public synchronized static String getConstructorDescriptor (Constructor constructor ) {
155- if (constructor == null ) return null ;
156- return constructor .getDeclaringClass ().getName () + "->" + constructor .getName () + "(" + Arrays .stream (constructor .getParameterTypes ()).map (Class ::getName ).collect (Collectors .joining ("," )) + ")" ;
157- }
158-
159153 public synchronized static String getFieldDescriptor (Field field ) {
160154 return field .getDeclaringClass ().getName () + "->" + field .getName () + ":" + field .getType ().getName ();
161155 }
@@ -488,16 +482,6 @@ public synchronized static Method loadDndModeMethod(ClassLoader classLoader) thr
488482 }
489483
490484 // TODO: Classes and methods to MediaQuality
491-
492- private static Class <?> loadMediaQualityClass (ClassLoader classLoader ) throws Exception {
493- return UnobfuscatorCache .getInstance ().getClass (classLoader , () -> {
494- var clazzMediaClass = findFirstClassUsingStrings (classLoader , StringMatchType .Contains , "getCorrectedResolution" );
495- if (clazzMediaClass == null ) throw new Exception ("MediaQuality class not found" );
496- return clazzMediaClass ;
497- });
498- }
499-
500-
501485 public synchronized static Method loadMediaQualityVideoMethod2 (ClassLoader classLoader ) throws Exception {
502486 return UnobfuscatorCache .getInstance ().getMethod (classLoader , () -> {
503487 var method = findFirstMethodUsingStrings (classLoader , StringMatchType .Contains , "getCorrectedResolution" );
@@ -655,14 +639,6 @@ public synchronized static Class<?> loadMaterialShapeDrawableClass(ClassLoader l
655639 });
656640 }
657641
658- public synchronized static Class <?> loadCustomDrawableClass (ClassLoader loader ) throws Exception {
659- return UnobfuscatorCache .getInstance ().getClass (loader , () -> {
660- var clazz = findFirstClassUsingStrings (loader , StringMatchType .Contains , "closeIconEnabled" );
661- if (clazz == null ) throw new Exception ("CustomDrawable class not found" );
662- return clazz ;
663- });
664- }
665-
666642 public synchronized static Method loadPropsBooleanMethod (ClassLoader loader ) throws Exception {
667643 return UnobfuscatorCache .getInstance ().getMethod (loader , () -> {
668644 var method = findFirstMethodUsingStrings (loader , StringMatchType .Contains , "Unknown BooleanField" );
@@ -1614,36 +1590,18 @@ public synchronized static Class loadListChannelItemClass(ClassLoader classLoade
16141590 });
16151591 }
16161592
1617- public synchronized static Method loadTextStatusComposer (ClassLoader classLoader ) throws Exception {
1618- return findFirstMethodUsingStrings (classLoader , StringMatchType .Contains , "Can't put value with type" );
1619- }
16201593
1621- public synchronized static Method loadTextStatusComposer2 (ClassLoader classLoader ) throws Exception {
1622- return UnobfuscatorCache .getInstance ().getMethod (classLoader , () -> {
1623- Class <?> TextDataClass = classLoader .loadClass ("com.whatsapp.TextData" );
1624- var result = dexkit .findClass (FindClass .create ().matcher (
1625- ClassMatcher .create ().addUsingString ("*" ).
1626- addMethod (MethodMatcher .create ().paramCount (1 ).addParamType (TextDataClass ))
1627- ));
1628- if (result .isEmpty ()) {
1629- var tscClazzData = dexkit .getClassData (WppCore .getTextStatusComposerFragmentClass (classLoader ));
1630- if (tscClazzData != null ) {
1631- for (var method : tscClazzData .getMethods ()) {
1632- var tdMethod = method .getInvokes ().stream ().filter (m -> m .isMethod () && m .getParamCount () == 1 && m .getParamTypes ().get (0 ).equals (dexkit .getClassData (TextDataClass ))).findFirst ();
1633- if (tdMethod .isPresent ()) {
1634- return tdMethod .get ().getMethodInstance (classLoader );
1635- }
1636- }
1637- }
1638-
1639- throw new RuntimeException ("TextStatusComposer2 class not found 1" );
1640- }
1594+ public synchronized static Method [] loadTextStatusData (ClassLoader classLoader ) throws Exception {
1595+ return UnobfuscatorCache .getInstance ().getMethods (classLoader , () -> {
1596+ var methods = dexkit .findMethod (
1597+ FindMethod .create ().matcher (
1598+ MethodMatcher .create ().addParamType ("com.whatsapp.TextData" )
1599+ )
1600+ );
1601+ if (methods .isEmpty ())
1602+ throw new RuntimeException ("loadTextStatusData method not found" );
16411603
1642- var foundClass = result .get (0 ).getInstance (classLoader );
1643- var resultMethod = ReflectionUtils .findMethodUsingFilter (foundClass , method -> method .getParameterCount () == 1 && method .getParameterTypes ()[0 ] == TextDataClass );
1644- if (resultMethod != null )
1645- return resultMethod ;
1646- throw new RuntimeException ("TextStatusComposer2 method not found 2" );
1604+ return methods .stream ().filter (MethodData ::isMethod ).map (methodData -> convertRealMethod (methodData , classLoader )).toArray (Method []::new );
16471605 });
16481606 }
16491607
@@ -1765,11 +1723,6 @@ public static synchronized Method loadCheckCustomRom(ClassLoader classLoader) th
17651723 return method ;
17661724 }
17671725
1768- // public static synchronized Class loadGetContactInfoClass(ClassLoader classLoader) throws Exception {
1769- // return UnobfuscatorCache.getInstance().getClass(classLoader, () -> findFirstClassUsingStrings(classLoader, StringMatchType.Contains, "unknown@unknown"));
1770- //
1771- // }
1772-
17731726 public static synchronized Method loadTranscribeMethod (ClassLoader classLoader ) throws Exception {
17741727 return UnobfuscatorCache .getInstance ().getMethod (classLoader , () -> findFirstMethodUsingStrings (classLoader , StringMatchType .Contains , "transcribe: starting transcription" ));
17751728 }
@@ -1869,33 +1822,6 @@ public static Class<?> loadStatusDistributionClass(ClassLoader classLoader) thro
18691822 });
18701823 }
18711824
1872- // public static Method loadChangeTitleLogoMethod(ClassLoader classLoader) throws Exception {
1873- // return UnobfuscatorCache.getInstance().getMethod(classLoader, () -> {
1874- // var id = Utils.getID("toolbar_logo", "id");
1875- // var methodData = dexkit.findMethod(
1876- // FindMethod.create()
1877- // .matcher(MethodMatcher.create().addUsingNumber(id))
1878- // );
1879- // if (methodData.isEmpty())
1880- // throw new RuntimeException("ChangeTitleLogo method not found");
1881- // return methodData.get(0).getMethodInstance(classLoader);
1882- // });
1883- // }
1884-
1885- // public static Field loadChangeTitleLogoField(ClassLoader classLoader) throws Exception {
1886- // return UnobfuscatorCache.getInstance().getField(classLoader, () -> {
1887- // var methodData = dexkit.getMethodData(loadChangeTitleLogoMethod(classLoader));
1888- // var clazz = WppCore.getHomeActivityClass(classLoader);
1889- // var usingFields = methodData.getUsingFields();
1890- // for (var uField : usingFields) {
1891- // var field = uField.getField().getFieldInstance(classLoader);
1892- // if (field.getDeclaringClass() == clazz && field.getType() == Integer.class) {
1893- // return field;
1894- // }
1895- // }
1896- // throw new RuntimeException("ChangeTitleLogo field not found");
1897- // });
1898- // }
18991825
19001826 public static Class <?> loadFilterItemClass (ClassLoader classLoader ) throws Exception {
19011827 return UnobfuscatorCache .getInstance ().getClass (classLoader , () -> {
@@ -1908,18 +1834,6 @@ public static Class<?> loadFilterItemClass(ClassLoader classLoader) throws Excep
19081834 });
19091835 }
19101836
1911- // public static Method loadActiveButtonNav(ClassLoader classLoader) throws Exception {
1912- // return UnobfuscatorCache.getInstance().getMethod(classLoader, () -> {
1913- // var methodList = dexkit.findClass(
1914- // FindClass.create().matcher(ClassMatcher.create().addUsingString("NavigationBar", StringMatchType.Equals))
1915- // ).findMethod(
1916- // FindMethod.create().matcher(MethodMatcher.create().name("setActiveIndicatorDrawable"))
1917- // );
1918- // return methodList.get(0).getMethodInstance(classLoader);
1919- // });
1920- //
1921- // }
1922-
19231837 public static Class [] loadProximitySensorListenerClasses (ClassLoader classLoader ) throws Exception {
19241838 return UnobfuscatorCache .getInstance ().getClasses (classLoader , () -> {
19251839 var classDataList = dexkit .findClass (
0 commit comments