@@ -967,6 +967,14 @@ public synchronized static Method loadNewMessageMethod(ClassLoader loader) throw
967967 var field = clazzMessage .getDeclaredField ("A02" );
968968 methodData = clazzData .findMethod (new FindMethod ().matcher (new MethodMatcher ().addUsingField (DexSignUtil .getFieldDescriptor (field )).returnType (String .class )));
969969 }
970+ if (methodData .isEmpty ()) {
971+ var csClazzData = dexkit .findClass (FindClass .create ().matcher (ClassMatcher .create ().addUsingString ("FMessageSystemScheduledCallStart/setData index out of bounds: " ))).singleOrNull ();
972+ if (csClazzData != null ) {
973+ var csClazz = csClazzData .getInstance (loader );
974+ var field = csClazz .getDeclaredField ("A02" );
975+ methodData = clazzData .findMethod (new FindMethod ().matcher (new MethodMatcher ().addUsingField (DexSignUtil .getFieldDescriptor (field )).returnType (String .class )));
976+ }
977+ }
970978 if (methodData .isEmpty ()) throw new RuntimeException ("NewMessage method not found" );
971979 return methodData .get (0 ).getMethodInstance (loader );
972980 });
@@ -1013,7 +1021,8 @@ public synchronized static Method loadGetEditMessageMethod(ClassLoader loader) t
10131021 }
10141022
10151023 // 21.xx+ method (static)
1016- if (Modifier .isStatic (invoke .getMethodInstance (loader ).getModifiers ()) && Objects .equals (invoke .getParamTypes ().get (0 ), methodData .getParamTypes ().get (0 ))) {
1024+ // 25.xx+ added additional type check
1025+ if (Modifier .isStatic (invoke .getMethodInstance (loader ).getModifiers ()) && Objects .equals (invoke .getParamTypes ().get (0 ), methodData .getParamTypes ().get (0 )) && !Objects .equals (invoke .getParamTypes ().get (0 ), invoke .getDeclaredClass ())) {
10171026 return invoke .getMethodInstance (loader );
10181027 }
10191028 }
@@ -1549,20 +1558,24 @@ public synchronized static Method loadTextStatusComposer2(ClassLoader classLoade
15491558 addMethod (MethodMatcher .create ().paramCount (1 ).addParamType (TextDataClass ))
15501559 ));
15511560 if (result .isEmpty ()) {
1552- result = dexkit .findClass (FindClass .create ().matcher (
1553- ClassMatcher .create ().addUsingString ("ViewOnce messages can not be forwarded" ).
1554- addMethod (MethodMatcher .create ().paramCount (1 ).addParamType (TextDataClass ))
1555- ));
1556- if (result .isEmpty ()) {
1557- throw new RuntimeException ("TextStatusComposer2 class not found" );
1561+ var tscClazzData = dexkit .getClassData ("com.whatsapp.statuscomposer.composer.TextStatusComposerFragment" );
1562+ if (tscClazzData != null ) {
1563+ for (var method : tscClazzData .getMethods ()) {
1564+ var tdMethod = method .getInvokes ().stream ().filter (m -> m .isMethod () && m .getParamCount () == 1 && m .getParamTypes ().get (0 ).equals (dexkit .getClassData (TextDataClass ))).findFirst ();
1565+ if (tdMethod .isPresent ()) {
1566+ return tdMethod .get ().getMethodInstance (classLoader );
1567+ }
1568+ }
15581569 }
1570+
1571+ throw new RuntimeException ("TextStatusComposer2 class not found 1" );
15591572 }
15601573
15611574 var foundClass = result .get (0 ).getInstance (classLoader );
15621575 var resultMethod = ReflectionUtils .findMethodUsingFilter (foundClass , method -> method .getParameterCount () == 1 && method .getParameterTypes ()[0 ] == TextDataClass );
15631576 if (resultMethod != null )
15641577 return resultMethod ;
1565- throw new RuntimeException ("TextStatusComposer2 method not found" );
1578+ throw new RuntimeException ("TextStatusComposer2 method not found 2 " );
15661579 });
15671580 }
15681581
0 commit comments