99import android .view .LayoutInflater ;
1010import android .view .Menu ;
1111import android .view .MenuInflater ;
12+ import android .view .MenuItem ;
1213import android .view .View ;
1314import android .view .ViewGroup ;
1415import android .widget .FrameLayout ;
@@ -866,9 +867,12 @@ public synchronized static Method loadSendPresenceMethod(ClassLoader loader) thr
866867
867868 public synchronized static Method loadPinnedLimitMethod (ClassLoader loader ) throws Exception {
868869 return UnobfuscatorCache .getInstance ().getMethod (loader , () -> {
869- var method = findFirstMethodUsingStrings (loader , StringMatchType .Contains , "count_progress" );
870+ var methodList = dexkit .findMethod (FindMethod .create ().matcher (MethodMatcher .create ().addUsingString ("count_progress" ).paramCount (1 , 2 )));
871+ if (methodList .isEmpty ()) throw new Exception ("PinnedLimit method not found" );
872+ var menuItemName = MenuItem .class .getName ();
873+ var method = methodList .parallelStream ().filter (m -> m .getParamTypes ().get (0 ).getName ().equals (menuItemName )).findFirst ().orElse (null );
870874 if (method == null ) throw new Exception ("PinnedLimit method not found" );
871- return method ;
875+ return method . getMethodInstance ( loader ) ;
872876 });
873877 }
874878
@@ -960,23 +964,13 @@ public synchronized static Method loadChatLimitDelete2Method(ClassLoader loader)
960964
961965 public synchronized static Method loadNewMessageMethod (ClassLoader loader ) throws Exception {
962966 return UnobfuscatorCache .getInstance ().getMethod (loader , () -> {
963- var clazzMessage = loadFMessageClass (loader );
964- var clazzData = Objects .requireNonNull (dexkit .getClassData (clazzMessage ));
965- var methodData = clazzData .findMethod (new FindMethod ().matcher (new MethodMatcher ().addUsingString ("\n " ).returnType (String .class )));
966- if (methodData .isEmpty ()) {
967- var field = clazzMessage .getDeclaredField ("A02" );
968- methodData = clazzData .findMethod (new FindMethod ().matcher (new MethodMatcher ().addUsingField (DexSignUtil .getFieldDescriptor (field )).returnType (String .class )));
969- }
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- }
978- if (methodData .isEmpty ()) throw new RuntimeException ("NewMessage method not found" );
979- return methodData .get (0 ).getMethodInstance (loader );
967+ var clazzMessageName = loadFMessageClass (loader ).getName ();
968+ var listMethods = dexkit .findMethod (FindMethod .create ().searchPackages ("com.whatsapp" ).matcher (MethodMatcher .create ().addUsingString ("extra_payment_note" , StringMatchType .Equals )));
969+ if (listMethods .isEmpty ()) throw new Exception ("NewMessage method not found" );
970+ var invokes = listMethods .get (0 ).getInvokes ();
971+ var method = invokes .parallelStream ().filter (invoke -> clazzMessageName .equals (invoke .getDeclaredClass ().getName ()) && invoke .getReturnType () != null && invoke .getReturnType ().getName ().equals ("java.lang.String" )).findFirst ().orElse (null );
972+ if (method == null ) throw new RuntimeException ("NewMessage method not found" );
973+ return method .getMethodInstance (loader );
980974 });
981975 }
982976
@@ -988,15 +982,17 @@ public synchronized static Method loadOriginalMessageKey(ClassLoader loader) thr
988982 });
989983 }
990984
991-
992985 public synchronized static Method loadNewMessageWithMediaMethod (ClassLoader loader ) throws Exception {
993- var clazzMessage = Objects .requireNonNull (dexkit .getClassData (loadFMessageClass (loader )));
994- var methodData = clazzMessage .findMethod (new FindMethod ().matcher (new MethodMatcher ().addUsingNumber (0x200000 ).returnType (String .class )));
995- if (methodData .isEmpty ()) {
996- methodData = clazzMessage .findMethod (new FindMethod ().matcher (new MethodMatcher ().addUsingString ("video" ).returnType (String .class )));
997- if (methodData .isEmpty ()) return null ;
998- }
999- return methodData .get (0 ).getMethodInstance (loader );
986+ return UnobfuscatorCache .getInstance ().getMethod (loader , () -> {
987+ var methodList = dexkit .findMethod (FindMethod .create ().matcher (MethodMatcher .create ().addUsingString ("INSERT_TABLE_MESSAGE_QUOTED" , StringMatchType .Equals )));
988+ if (methodList .isEmpty ()) throw new Exception ("NewMessageWithMedia method not found" );
989+ var methodData = methodList .get (0 );
990+ var invokes = methodData .getInvokes ();
991+ var clazzMessageName = loadFMessageClass (loader ).getName ();
992+ var method = invokes .parallelStream ().filter (invoke -> clazzMessageName .equals (invoke .getDeclaredClass ().getName ()) && invoke .getReturnType () != null && invoke .getReturnType ().getName ().equals ("java.lang.String" )).findFirst ().orElse (null );
993+ if (method == null ) throw new RuntimeException ("NewMessageWithMedia method not found" );
994+ return method .getMethodInstance (loader );
995+ });
1000996 }
1001997
1002998 public synchronized static Method loadMessageEditMethod (ClassLoader loader ) throws Exception {
0 commit comments