@@ -38,14 +38,16 @@ public void doHook() throws Throwable {
3838 var setColorTextComposer = Unobfuscator .loadTextStatusComposer (classLoader );
3939 log ("setColorTextComposer: " + Unobfuscator .getMethodDescriptor (setColorTextComposer ));
4040
41- if (setColorTextComposer != null ) {
42- XposedBridge .hookAllConstructors (setColorTextComposer .getDeclaringClass (), new XC_MethodHook () {
41+ var textModelClass = XposedHelpers .findClassIfExists ("com.whatsapp.statuscomposer.composer.TextStatusComposerViewModel" , classLoader );
42+
43+ if (textModelClass != null ) {
44+ XposedBridge .hookAllConstructors (textModelClass , new XC_MethodHook () {
4345 @ Override
4446 protected void beforeHookedMethod (MethodHookParam param ) throws Throwable {
4547 textComposerModel .set (param .thisObject );
4648 }
4749 });
48- var arrMethod = ReflectionUtils .findMethodUsingFilter (setColorTextComposer . getDeclaringClass () , method -> method .getParameterCount () == 1 && method .getParameterTypes ()[0 ] == int .class && method .getReturnType () == int .class );
50+ var arrMethod = ReflectionUtils .findMethodUsingFilter (textModelClass , method -> method .getParameterCount () == 1 && method .getParameterTypes ()[0 ] == int .class && method .getReturnType () == int .class );
4951 XposedBridge .hookMethod (arrMethod , new XC_MethodHook () {
5052 @ Override
5153 protected void beforeHookedMethod (MethodHookParam param ) throws Throwable {
@@ -73,9 +75,11 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
7375 pickerColor .setOnLongClickListener (v -> {
7476 var dialog = new SimpleColorPickerDialog (activity , color -> {
7577 try {
76- if (setColorTextComposer != null ) {
77- var mInstance = textComposerModel .get ();
78- ReflectionUtils .callMethod (setColorTextComposer , mInstance , color );
78+ if (textModelClass != null ) {
79+ var textModel = textComposerModel .get ();
80+ var mField = ReflectionUtils .getFieldsByType (textModel .getClass (), setColorTextComposer .getDeclaringClass ()).get (0 );
81+ var auxInstance = ReflectionUtils .getObjectField (mField , textModel );
82+ ReflectionUtils .callMethod (setColorTextComposer , auxInstance , "background_color_key" , color );
7983 } else {
8084 Field fieldInt = ReflectionUtils .getFieldByType (param .thisObject .getClass (), int .class );
8185 fieldInt .setInt (param .thisObject , color );
0 commit comments