@@ -150,12 +150,6 @@ public synchronized static String getMethodDescriptor(Method method) {
150
150
return method .getDeclaringClass ().getName () + "->" + method .getName () + "(" + Arrays .stream (method .getParameterTypes ()).map (Class ::getName ).collect (Collectors .joining ("," )) + ")" ;
151
151
}
152
152
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
-
159
153
public synchronized static String getFieldDescriptor (Field field ) {
160
154
return field .getDeclaringClass ().getName () + "->" + field .getName () + ":" + field .getType ().getName ();
161
155
}
@@ -488,16 +482,6 @@ public synchronized static Method loadDndModeMethod(ClassLoader classLoader) thr
488
482
}
489
483
490
484
// 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
-
501
485
public synchronized static Method loadMediaQualityVideoMethod2 (ClassLoader classLoader ) throws Exception {
502
486
return UnobfuscatorCache .getInstance ().getMethod (classLoader , () -> {
503
487
var method = findFirstMethodUsingStrings (classLoader , StringMatchType .Contains , "getCorrectedResolution" );
@@ -655,14 +639,6 @@ public synchronized static Class<?> loadMaterialShapeDrawableClass(ClassLoader l
655
639
});
656
640
}
657
641
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
-
666
642
public synchronized static Method loadPropsBooleanMethod (ClassLoader loader ) throws Exception {
667
643
return UnobfuscatorCache .getInstance ().getMethod (loader , () -> {
668
644
var method = findFirstMethodUsingStrings (loader , StringMatchType .Contains , "Unknown BooleanField" );
@@ -1614,36 +1590,18 @@ public synchronized static Class loadListChannelItemClass(ClassLoader classLoade
1614
1590
});
1615
1591
}
1616
1592
1617
- public synchronized static Method loadTextStatusComposer (ClassLoader classLoader ) throws Exception {
1618
- return findFirstMethodUsingStrings (classLoader , StringMatchType .Contains , "Can't put value with type" );
1619
- }
1620
1593
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" );
1641
1603
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 );
1647
1605
});
1648
1606
}
1649
1607
@@ -1765,11 +1723,6 @@ public static synchronized Method loadCheckCustomRom(ClassLoader classLoader) th
1765
1723
return method ;
1766
1724
}
1767
1725
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
-
1773
1726
public static synchronized Method loadTranscribeMethod (ClassLoader classLoader ) throws Exception {
1774
1727
return UnobfuscatorCache .getInstance ().getMethod (classLoader , () -> findFirstMethodUsingStrings (classLoader , StringMatchType .Contains , "transcribe: starting transcription" ));
1775
1728
}
@@ -1869,33 +1822,6 @@ public static Class<?> loadStatusDistributionClass(ClassLoader classLoader) thro
1869
1822
});
1870
1823
}
1871
1824
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
- // }
1899
1825
1900
1826
public static Class <?> loadFilterItemClass (ClassLoader classLoader ) throws Exception {
1901
1827
return UnobfuscatorCache .getInstance ().getClass (classLoader , () -> {
@@ -1908,18 +1834,6 @@ public static Class<?> loadFilterItemClass(ClassLoader classLoader) throws Excep
1908
1834
});
1909
1835
}
1910
1836
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
-
1923
1837
public static Class [] loadProximitySensorListenerClasses (ClassLoader classLoader ) throws Exception {
1924
1838
return UnobfuscatorCache .getInstance ().getClasses (classLoader , () -> {
1925
1839
var classDataList = dexkit .findClass (
0 commit comments