@@ -215,7 +215,7 @@ public synchronized static Method loadReceiptOutsideChat(ClassLoader classLoader
215215 public synchronized static Method loadReceiptInChat (ClassLoader classLoader ) throws Exception {
216216 return UnobfuscatorCache .getInstance ().getMethod (classLoader , () -> {
217217 var method = loadReceiptMethod (classLoader );
218- var methodDataList = dexkit .findMethod (new FindMethod ().matcher (new MethodMatcher ().addUsingString ("callCreatorJid" ).addUsingString ("reject" ).addUsingNumber ( 6175 ). addInvoke (DexSignUtil .getMethodDescriptor (method ))));
218+ var methodDataList = dexkit .findMethod (new FindMethod ().matcher (new MethodMatcher ().addUsingString ("callCreatorJid" ).addUsingString ("reject" ).addInvoke (DexSignUtil .getMethodDescriptor (method ))));
219219 if (methodDataList .isEmpty ()) throw new Exception ("Receipt method not found" );
220220 return methodDataList .get (0 ).getMethodInstance (classLoader );
221221 });
@@ -249,6 +249,25 @@ public synchronized static Field loadBroadcastTagField(ClassLoader classLoader)
249249 var clazzData = dexkit .findClass (FindClass .create ().matcher (ClassMatcher .create ().addUsingString ("UPDATE_MESSAGE_MAIN_BROADCAST_SCAN_SQL" )));
250250 if (clazzData .isEmpty ()) throw new Exception ("BroadcastTag class not found" );
251251 var methodData = dexkit .findMethod (FindMethod .create ().searchInClass (clazzData ).matcher (MethodMatcher .create ().usingStrings ("participant_hash" , "view_mode" , "broadcast" )));
252+
253+ // 2.25.18.xx, they splitted method and moved to the fmessage
254+ if (methodData .isEmpty ()) {
255+ methodData = dexkit .findMethod (FindMethod .create ().searchInClass (clazzData ).matcher (MethodMatcher .create ().usingStrings ("received_timestamp" , "view_mode" , "message" )));
256+ if (!methodData .isEmpty ()) {
257+ var calledMethods = methodData .get (0 ).getInvokes ();
258+ for (var cmethod : calledMethods ) {
259+ if (Modifier .isStatic (cmethod .getModifiers ()) && cmethod .getParamCount () == 2 && fmessage .getName ().equals (cmethod .getDeclaredClass ().getName ())) {
260+ var pTypes = cmethod .getParamTypes ();
261+ if (pTypes .get (0 ).getName ().equals (ContentValues .class .getName ()) && pTypes .get (1 ).getName ().equals (fmessage .getName ())) {
262+ methodData .clear ();
263+ methodData .add (cmethod );
264+ break ;
265+ }
266+ }
267+ }
268+ }
269+ }
270+
252271 if (methodData .isEmpty ()) throw new Exception ("BroadcastTag method support not found" );
253272 var usingFields = methodData .get (0 ).getUsingFields ();
254273 for (var ufield : usingFields ) {
@@ -813,6 +832,7 @@ public synchronized static Method loadBlueOnReplayWaJobManagerMethod(ClassLoader
813832 public synchronized static Class loadArchiveChatClass (ClassLoader loader ) throws Exception {
814833 return UnobfuscatorCache .getInstance ().getClass (loader , () -> {
815834 var clazz = findFirstClassUsingStrings (loader , StringMatchType .Contains , "archive/set-content-indicator-to-empty" );
835+ if (clazz == null ) clazz = findFirstClassUsingStrings (loader , StringMatchType .Contains , "archive/Unsupported mode in ArchivePreviewView:" );
816836 if (clazz == null ) throw new Exception ("ArchiveHideView method not found" );
817837 return clazz ;
818838 });
@@ -887,7 +907,16 @@ public synchronized static Method loadSendPresenceMethod(ClassLoader loader) thr
887907 return UnobfuscatorCache .getInstance ().getMethod (loader , () -> {
888908 var methodData = dexkit .findMethod (FindMethod .create ().matcher (MethodMatcher .create ().addUsingString ("app/send-presence-subscription jid=" )));
889909 if (methodData .isEmpty ()) throw new Exception ("SendPresence method not found" );
890- var newMethod = methodData .get (0 ).getCallers ().singleOrNull (method1 -> method1 .getParamCount () == 4 );
910+ var methodCallers = methodData .get (0 ).getCallers ();
911+ if (methodCallers .isEmpty ()) {
912+ var method = methodData .get (0 );
913+ var superMethodInterfaces = method .getDeclaredClass ().getInterfaces ();
914+ if (superMethodInterfaces .isEmpty ()) throw new Exception ("SendPresence method interface list empty" );
915+ var superMethod = superMethodInterfaces .get (0 ).findMethod (FindMethod .create ().matcher (MethodMatcher .create ().name (method .getName ()))).firstOrNull ();
916+ if (superMethod == null ) throw new Exception ("SendPresence method interface method not found" );
917+ methodCallers = superMethod .getCallers ();
918+ }
919+ var newMethod = methodCallers .firstOrNull (method1 -> method1 .getParamCount () == 4 );
891920 if (newMethod == null ) throw new Exception ("SendPresence method not found 2" );
892921 return newMethod .getMethodInstance (loader );
893922 });
@@ -1637,21 +1666,53 @@ public synchronized static Method loadCopiedMessageMethod(ClassLoader classLoade
16371666 });
16381667 }
16391668
1640- public synchronized static Method loadSenderPlayed (ClassLoader classLoader ) throws Exception {
1641- return UnobfuscatorCache .getInstance ().getMethod (classLoader , () -> {
1669+ public synchronized static Class <?> loadSenderPlayedClass (ClassLoader classLoader ) throws Exception {
1670+ return UnobfuscatorCache .getInstance ().getClass (classLoader , () -> {
16421671 var clazz = findFirstClassUsingStrings (classLoader , StringMatchType .Contains , "sendmethods/sendClearDirty" );
16431672 if (clazz == null ) throw new RuntimeException ("SenderPlayed class not found" );
1673+ return clazz ;
1674+ });
1675+ }
1676+
1677+ public synchronized static Method loadSenderPlayedMethod (ClassLoader classLoader ) throws Exception {
1678+ return UnobfuscatorCache .getInstance ().getMethod (classLoader , () -> {
1679+ var clazz = loadSenderPlayedClass (classLoader );
16441680 var fmessageClass = loadFMessageClass (classLoader );
1645- var methodResult = ReflectionUtils .findMethodUsingFilter (clazz , method -> method .getParameterCount () == 1 && fmessageClass .isAssignableFrom (method .getParameterTypes ()[0 ]));
1646- if (methodResult == null ) throw new RuntimeException ("SenderPlayed method not found" );
1681+ Method methodResult = null ;
1682+ for (var method : clazz .getMethods ()) {
1683+ if (method .getParameterCount () == 1 && fmessageClass .isAssignableFrom (method .getParameterTypes ()[0 ])) {
1684+ methodResult = method ;
1685+ break ;
1686+ }
1687+ }
1688+
1689+ // 2.25.19.xx, they refactored the SenderPlayed class
1690+ if (methodResult == null ) {
1691+ var method = findFirstMethodUsingStrings (classLoader , StringMatchType .Contains , "mediaHash and fileType not both present for upload URL generation" );
1692+ if (method != null ) {
1693+ var cMethods = dexkit .getMethodData (method ).getInvokes ();
1694+ Collections .reverse (cMethods );
1695+ for (var cmethod : cMethods ) {
1696+ if (cmethod .isMethod () && cmethod .getParamCount () == 1 ) {
1697+ var cParamType = cmethod .getParamTypes ().get (0 ).getInstance (classLoader );
1698+ if (fmessageClass .isAssignableFrom (cParamType )) {
1699+ methodResult = cmethod .getMethodInstance (classLoader );
1700+ break ;
1701+ }
1702+ }
1703+ }
1704+ }
1705+ }
1706+
1707+ if (methodResult == null ) throw new RuntimeException ("SenderPlayed method not found 2" );
16471708 return methodResult ;
16481709 });
16491710 }
16501711
16511712 public synchronized static Method loadSenderPlayedBusiness (ClassLoader classLoader ) throws Exception {
16521713 return UnobfuscatorCache .getInstance ().getMethod (classLoader , () -> {
1653- var loadSenderPlayed = loadSenderPlayed (classLoader );
1654- var foundMethod = ReflectionUtils .findMethodUsingFilter (loadSenderPlayed . getDeclaringClass () , method -> method .getParameterCount () > 0 && method .getParameterTypes ()[0 ] == Set .class );
1714+ var loadSenderPlayed = loadSenderPlayedClass (classLoader );
1715+ var foundMethod = ReflectionUtils .findMethodUsingFilter (loadSenderPlayed , method -> method .getParameterCount () > 0 && method .getParameterTypes ()[0 ] == Set .class );
16551716 if (foundMethod == null )
16561717 throw new RuntimeException ("SenderPlayedBusiness method not found" );
16571718 return foundMethod ;
0 commit comments