@@ -150,9 +150,12 @@ public synchronized static Class<?> findFirstClassUsingStringsFilter(ClassLoader
150150 }
151151
152152 public synchronized static Class <?> findFirstClassUsingName (ClassLoader classLoader , StringMatchType type , String name ) throws Exception {
153- var result = dexkit .findClass (FindClass .create ().matcher (ClassMatcher .create ().className (name , type )));
154- if (result .isEmpty ()) return null ;
155- return result .get (0 ).getInstance (classLoader );
153+ return UnobfuscatorCache .getInstance ().getClass (classLoader , name , () -> {
154+ var result = dexkit .findClass (FindClass .create ().matcher (ClassMatcher .create ().className (name , type )));
155+ if (result .isEmpty ())
156+ throw new ClassNotFoundException ("Class not found: " + name );
157+ return result .get (0 ).getInstance (classLoader );
158+ });
156159 }
157160
158161 public synchronized static String getMethodDescriptor (Method method ) {
@@ -1495,9 +1498,12 @@ public synchronized static Class getFilterView(ClassLoader loader) throws Except
14951498
14961499 public synchronized static Class loadActionUser (ClassLoader loader ) throws Exception {
14971500 return UnobfuscatorCache .getInstance ().getClass (loader , () -> {
1498- var results = dexkit .findClass (new FindClass ().matcher (new ClassMatcher ().addUsingString ("UserActions/reportIfBadTime: time=" )));
1499- if (results .isEmpty ()) throw new RuntimeException ("ActionUser class not found" );
1500- return results .get (0 ).getInstance (loader );
1501+ for (String s : List .of ("UserActions/reportIfBadTime: time=" , "UserActions/createFMessageTextFromUserInputs" , "UserActions/userActionKeepInChat" )) {
1502+ var clazz = findFirstClassUsingStrings (loader , StringMatchType .Contains , s );
1503+ if (clazz != null )
1504+ return clazz ;
1505+ }
1506+ throw new ClassNotFoundException ("ActionUser class not found" );
15011507 });
15021508 }
15031509
@@ -1533,7 +1539,10 @@ public synchronized static Method loadOnInsertReceipt(ClassLoader classLoader) t
15331539
15341540 public synchronized static Method loadSendAudioTypeMethod (ClassLoader classLoader ) throws Exception {
15351541 return UnobfuscatorCache .getInstance ().getMethod (classLoader , () -> {
1536- var method = classLoader .loadClass ("com.whatsapp.status.playback.MessageReplyActivity" ).getMethod ("onActivityResult" , int .class , int .class , android .content .Intent .class );
1542+ var classMsgReplyAct = Unobfuscator .findFirstClassUsingName (classLoader , StringMatchType .EndsWith , "MessageReplyActivity" );
1543+ if (classMsgReplyAct == null )
1544+ throw new ClassNotFoundException ("Class MessageReplyActivity not found" );
1545+ var method = classMsgReplyAct .getMethod ("onActivityResult" , int .class , int .class , android .content .Intent .class );
15371546 var methodData = Objects .requireNonNull (dexkit .getMethodData (method ));
15381547 var invokes = methodData .getInvokes ();
15391548 for (var invoke : invokes ) {
@@ -1544,7 +1553,7 @@ public synchronized static Method loadSendAudioTypeMethod(ClassLoader classLoade
15441553 return m1 ;
15451554 }
15461555 }
1547- throw new RuntimeException ("SendAudioType method not found" );
1556+ throw new NoSuchMethodException ("SendAudioType method not found" );
15481557 });
15491558 }
15501559
@@ -1941,16 +1950,18 @@ public static Class<?> loadFilterItemClass(ClassLoader classLoader) throws Excep
19411950 MethodMatcher .create ().addUsingNumber (Utils .getID ("invisible_height_placeholder" , "id" ))
19421951 .addUsingNumber (Utils .getID ("container_view" , "id" ))
19431952 ));
1944- if (methodList .isEmpty ()) {
1945- var applyClazz = findFirstClassUsingStrings (classLoader , StringMatchType .Contains , "has_seen_detected_outcomes_nux" );
1946- if (applyClazz != null ) {
1947- methodList = dexkit .findMethod (FindMethod .create ().matcher (
1948- MethodMatcher .create ().paramTypes (View .class , applyClazz )
1949- ));
1950- }
1953+ if (!methodList .isEmpty ())
1954+ return methodList .get (0 ).getClassInstance (classLoader );
1955+
1956+ for (var s : List .of ("ConversationsFilter/selectFilter" , "has_seen_detected_outcomes_nux" )) {
1957+ var applyClazz = findFirstClassUsingStrings (classLoader , StringMatchType .Contains , s );
1958+ if (applyClazz == null ) continue ;
1959+ methodList = dexkit .findMethod (FindMethod .create ().matcher (
1960+ MethodMatcher .create ().paramTypes (View .class , applyClazz )
1961+ ));
1962+ if (!methodList .isEmpty ()) return methodList .get (0 ).getClassInstance (classLoader );
19511963 }
1952- if (methodList .isEmpty ()) throw new RuntimeException ("FilterItemClass Not Found" );
1953- return methodList .get (0 ).getClassInstance (classLoader );
1964+ throw new RuntimeException ("FilterItemClass Not Found" );
19541965 });
19551966 }
19561967
0 commit comments