1414import android .view .View ;
1515import android .view .ViewGroup ;
1616import android .widget .FrameLayout ;
17+ import android .widget .ImageView ;
1718import android .widget .TextView ;
1819
1920import androidx .annotation .Nullable ;
5556import java .util .TimerTask ;
5657import java .util .stream .Collectors ;
5758
59+ import de .robv .android .xposed .XposedBridge ;
5860import de .robv .android .xposed .XposedHelpers ;
5961
6062public class Unobfuscator {
@@ -125,6 +127,7 @@ public synchronized static Class<?> findFirstClassUsingStrings(ClassLoader class
125127 return result .get (0 ).getInstance (classLoader );
126128 }
127129
130+
128131 public synchronized static Class <?>[] findAllClassUsingStrings (ClassLoader classLoader , StringMatchType type , String ... strings ) throws Exception {
129132 var matcher = new ClassMatcher ();
130133 for (String string : strings ) {
@@ -135,6 +138,7 @@ public synchronized static Class<?>[] findAllClassUsingStrings(ClassLoader class
135138 return result .stream ().map (classData -> convertRealClass (classData , classLoader )).filter (Objects ::nonNull ).toArray (Class []::new );
136139 }
137140
141+
138142 public synchronized static Class <?> findFirstClassUsingStringsFilter (ClassLoader classLoader , String packageFilter , StringMatchType type , String ... strings ) throws Exception {
139143 var matcher = new ClassMatcher ();
140144 for (String string : strings ) {
@@ -145,6 +149,12 @@ public synchronized static Class<?> findFirstClassUsingStringsFilter(ClassLoader
145149 return result .get (0 ).getInstance (classLoader );
146150 }
147151
152+ 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 );
156+ }
157+
148158 public synchronized static String getMethodDescriptor (Method method ) {
149159 if (method == null ) return null ;
150160 return method .getDeclaringClass ().getName () + "->" + method .getName () + "(" + Arrays .stream (method .getParameterTypes ()).map (Class ::getName ).collect (Collectors .joining ("," )) + ")" ;
@@ -285,10 +295,22 @@ public synchronized static Field loadBroadcastTagField(ClassLoader classLoader)
285295 public synchronized static Method loadBroadcastTagMethod (ClassLoader classLoader ) throws Exception {
286296 return UnobfuscatorCache .getInstance ().getMethod (classLoader , () -> {
287297 var field = loadBroadcastTagField (classLoader );
298+ XposedBridge .log (DexSignUtil .getFieldDescriptor (field ));
288299 var clazzData = dexkit .findClass (FindClass .create ().matcher (ClassMatcher .create ().addUsingString ("ConversationRow/setUpUserNameInGroupView" )));
289300 if (clazzData .isEmpty ())
290301 throw new Exception ("BroadcastTag: ConversationRow Class not found" );
291302 var method = dexkit .findMethod (FindMethod .create ().searchInClass (clazzData ).matcher (MethodMatcher .create ().addUsingField (DexSignUtil .getFieldDescriptor (field ))));
303+ if (method .isEmpty ()) {
304+ var findViewId = View .class .getDeclaredMethod ("findViewById" , int .class );
305+ var setImageResource = ImageView .class .getDeclaredMethod ("setImageResource" , int .class );
306+ method = dexkit .findMethod (
307+ FindMethod .create ().matcher (
308+ MethodMatcher .create ().addUsingField (DexSignUtil .getFieldDescriptor (field ))
309+ .addInvoke (DexSignUtil .getMethodDescriptor (findViewId ))
310+ .addInvoke (DexSignUtil .getMethodDescriptor (setImageResource ))
311+ )
312+ );
313+ }
292314 if (method .isEmpty ())
293315 throw new Exception ("BroadcastTag: ConversationRow Method not found" );
294316 return method .get (0 ).getMethodInstance (classLoader );
@@ -317,7 +339,8 @@ public synchronized static Method loadHideViewSendReadJob(ClassLoader classLoade
317339 public synchronized static Method loadHideViewInChatMethod (ClassLoader classLoader ) throws Exception {
318340 return UnobfuscatorCache .getInstance ().getMethod (classLoader , () -> {
319341 Method method = findFirstMethodUsingStrings (classLoader , StringMatchType .Contains , "ReadReceipts/acknowledgeMessageIfNeeded" );
320- if (method == null ) method = findFirstMethodUsingStrings (classLoader , StringMatchType .Contains , "ReadReceipts/sendDeliveryReceiptIfNotRetry" );
342+ if (method == null )
343+ method = findFirstMethodUsingStrings (classLoader , StringMatchType .Contains , "ReadReceipts/sendDeliveryReceiptIfNotRetry" );
321344 if (method == null ) throw new Exception ("HideViewInChat method not found" );
322345 return method ;
323346 });
@@ -1399,7 +1422,8 @@ public synchronized static Constructor loadStartPrefsConfig(ClassLoader loader)
13991422
14001423 public synchronized static Method loadCheckOnlineMethod (ClassLoader loader ) throws Exception {
14011424 var method = findFirstMethodUsingStrings (loader , StringMatchType .Contains , "MessageHandler/handleConnectionThreadReady connectionready" );
1402- if (method == null ) method = findFirstMethodUsingStrings (loader , StringMatchType .Contains , "app/xmpp/recv/handle_available" );
1425+ if (method == null )
1426+ method = findFirstMethodUsingStrings (loader , StringMatchType .Contains , "app/xmpp/recv/handle_available" );
14031427 if (method == null ) throw new RuntimeException ("CheckOnline method not found" );
14041428 return method ;
14051429 }
0 commit comments