@@ -227,25 +227,39 @@ public synchronized static Method loadGhostModeMethod(ClassLoader classLoader) t
227227
228228 // TODO: Classes and Methods for Receipt
229229
230- public synchronized static Method loadReceiptMethod (ClassLoader classLoader ) throws Exception {
230+ public static Method loadReceiptMethod (ClassLoader classLoader ) throws Exception {
231231 return UnobfuscatorCache .getInstance ().getMethod (classLoader , () -> {
232- var classDeviceJid = Unobfuscator .findFirstClassUsingName (classLoader , StringMatchType .EndsWith ,
233- "jid.DeviceJid" );
234- var classPhoneUserJid = Unobfuscator .findFirstClassUsingName (classLoader , StringMatchType .EndsWith ,
235- "jid.PhoneUserJid" );
232+ var classDeviceJid = Unobfuscator .findFirstClassUsingName (
233+ classLoader , StringMatchType .EndsWith , "jid.DeviceJid" );
234+ var classPhoneUserJid = Unobfuscator .findFirstClassUsingName (
235+ classLoader , StringMatchType .EndsWith , "jid.PhoneUserJid" );
236+ var classProtocolTreeNode = findFirstClassUsingStrings (
237+ classLoader , StringMatchType .Contains , "ProtocolTreeNode/getAttributeJid" );
238+
236239 var methods = dexkit .findMethod (
237240 FindMethod .create ()
238241 .matcher (MethodMatcher .create ()
239242 .addUsingString ("receipt" )
240- .paramCount (5 , 8 )));
243+ .returnType (classProtocolTreeNode ))
244+ );
241245
242246 for (var method : methods ) {
243247 var params = method .getParamTypeNames ();
244- if (params .contains (classDeviceJid .getName ()) && params .contains (classPhoneUserJid .getName ()))
245- return method .getMethodInstance (classLoader );
248+
249+ boolean hasRequiredParams =
250+ params .contains (classDeviceJid .getName ()) &&
251+ params .contains (classPhoneUserJid .getName ());
252+
253+ if (!hasRequiredParams ) continue ;
254+
255+ return method .getMethodInstance (classLoader );
246256 }
247257
248- throw new NoSuchMethodError ("Receipt method not found" );
258+ throw new NoSuchMethodError (
259+ "Receipt method not found. returnType=" + classProtocolTreeNode .getName ()
260+ + ", requiredParams=[" + classDeviceJid .getName ()
261+ + ", " + classPhoneUserJid .getName () + "]"
262+ );
249263 });
250264 }
251265
@@ -929,22 +943,19 @@ public synchronized static Field loadMessageKeyField(ClassLoader loader) throws
929943 });
930944 }
931945
932- public synchronized static Class <?> loadConversationRowClass (ClassLoader loader ) throws Exception {
946+
947+ public static Class <?> loadConversationRowClass (ClassLoader loader ) throws Exception {
933948 return UnobfuscatorCache .getInstance ().getClass (loader , () -> {
934- var clazz = findFirstClassUsingStrings (loader , StringMatchType .Contains ,
935- "ConversationRow/setupUserNameInGroupView/" );
936- if (clazz != null )
937- return clazz ;
938- var conversation_header = Utils .getID ("conversation_row_participant_header_view_stub" , "id" );
939- var nameId = Utils .getID ("name_in_group" , "id" );
940- var classData = dexkit
941- .findClass (FindClass .create ()
942- .matcher (ClassMatcher .create ().addMethod (
943- MethodMatcher .create ().addUsingNumber (conversation_header ).addUsingNumber (nameId ))))
944- .singleOrNull ();
945- if (classData == null )
946- throw new Exception ("ConversationRow class not found" );
947- return classData .getInstance (loader );
949+ var clazz = findFirstClassUsingStrings (loader , StringMatchType .Contains , "ConversationRow/setupUserNameInGroupView/" );
950+ if (clazz != null ) return clazz ;
951+ var conversation_header = Utils .getID ("name_in_group" , "id" );
952+ var classData = dexkit .findClass (FindClass .create ().matcher (ClassMatcher .create ().addMethod (MethodMatcher .create ().addUsingNumber (conversation_header ))));
953+ for (ClassData c : classData ) {
954+ var clazzInstance = c .getInstance (loader );
955+ if (ViewGroup .class .isAssignableFrom (clazzInstance ))
956+ return clazzInstance ;
957+ }
958+ return null ;
948959 });
949960 }
950961
@@ -1886,13 +1897,19 @@ public synchronized static Method loadShowDialogStatusMethod(ClassLoader classLo
18861897 });
18871898 }
18881899
1889- public synchronized static Method loadPlaybackSpeed (ClassLoader classLoader ) throws Exception {
1900+ public static Method loadPlaybackSpeed (ClassLoader classLoader ) throws Exception {
18901901 return UnobfuscatorCache .getInstance ().getMethod (classLoader , () -> {
1891- var method = findFirstMethodUsingStrings (classLoader , StringMatchType .Contains ,
1892- "heroaudioplayer/setPlaybackSpeed" );
1893- if (method == null )
1894- throw new RuntimeException ("PlaybackSpeed method not found" );
1895- return method ;
1902+ var method = findFirstMethodUsingStrings (classLoader , StringMatchType .Contains , "heroaudioplayer/setPlaybackSpeed" );
1903+ if (method != null ) return method ;
1904+
1905+ var methodData = dexkit .findMethod (
1906+ FindMethod .create ().matcher (
1907+ MethodMatcher .create ().addUsingString ("setPlaybackSpeed" , StringMatchType .Equals ).addUsingString ("newSpeed" )
1908+ )
1909+ ).singleOrNull ();
1910+
1911+ if (methodData == null ) throw new RuntimeException ("PlaybackSpeed method not found" );
1912+ return methodData .getMethodInstance (classLoader );
18961913 });
18971914 }
18981915
@@ -2772,4 +2789,8 @@ public static Class<?> loadGetProfilePhoto(ClassLoader classLoader) throws Excep
27722789 public static Class <?> loadDialerProfilePictureLoader (ClassLoader classLoader ) throws Exception {
27732790 return UnobfuscatorCache .getInstance ().getClass (classLoader , () -> findFirstClassUsingStrings (classLoader , StringMatchType .Contains , "DialerProfilePictureLoader/syncFetchProfilePhoto/onPhotoReceived" ));
27742791 }
2792+
2793+ public static Class <?> loadBottomBarConfigClass (ClassLoader classLoader ) throws Exception {
2794+ return UnobfuscatorCache .getInstance ().getClass (classLoader , () -> findFirstClassUsingStrings (classLoader , StringMatchType .Contains , "BottomBarConfig(" ));
2795+ }
27752796}
0 commit comments