2121import com .wmods .wppenhacer .xposed .core .Feature ;
2222import com .wmods .wppenhacer .xposed .core .WppCore ;
2323import com .wmods .wppenhacer .xposed .core .components .AlertDialogWpp ;
24+ import com .wmods .wppenhacer .xposed .core .devkit .Unobfuscator ;
2425import com .wmods .wppenhacer .xposed .features .others .MenuHome ;
2526import com .wmods .wppenhacer .xposed .utils .DesignUtils ;
2627import com .wmods .wppenhacer .xposed .utils .ReflectionUtils ;
2930
3031import org .json .JSONObject ;
3132
33+ import java .lang .reflect .Field ;
3234import java .lang .reflect .Method ;
3335import java .util .ArrayList ;
3436import java .util .Objects ;
4042public class CustomPrivacy extends Feature {
4143 private Method chatUserJidMethod ;
4244 private Method groupUserJidMethod ;
45+ private Field waContactField ;
4346
4447 public CustomPrivacy (@ NonNull ClassLoader classLoader , @ NonNull XSharedPreferences preferences ) {
4548 super (classLoader , preferences );
@@ -60,6 +63,7 @@ public void doHook() throws Throwable {
6063 Class <?> userJidClass = XposedHelpers .findClass ("com.whatsapp.jid.UserJid" , classLoader );
6164 Class <?> groupJidClass = XposedHelpers .findClass ("com.whatsapp.jid.GroupJid" , classLoader );
6265
66+ waContactField = Unobfuscator .loadWaContactFromContactInfo (classLoader );
6367 chatUserJidMethod = ReflectionUtils .findMethodUsingFilter (ContactInfoActivityClass , method -> method .getParameterCount () == 0 && userJidClass .isAssignableFrom (method .getReturnType ()));
6468 groupUserJidMethod = ReflectionUtils .findMethodUsingFilter (GroupInfoActivityClass , method -> method .getParameterCount () == 0 && groupJidClass .isAssignableFrom (method .getReturnType ()));
6569
@@ -224,7 +228,14 @@ private void showPrivacyDialog(Activity activity, boolean isChat) {
224228
225229 private Object getUserJid (Activity activity , boolean isChat ) {
226230 if (isChat ) {
227- return ReflectionUtils .callMethod (chatUserJidMethod , activity );
231+ var userJid = ReflectionUtils .callMethod (chatUserJidMethod , activity );
232+ if (Objects .requireNonNullElse (WppCore .getRawString (userJid ), "" ).contains ("@lid" )) {
233+ var waContact = ReflectionUtils .getObjectField (waContactField , activity );
234+ Class <?> phoneUserJidClass = XposedHelpers .findClass ("com.whatsapp.jid.PhoneUserJid" , classLoader );
235+ Field phoneUserJidField = ReflectionUtils .getFieldByType (waContact .getClass (), phoneUserJidClass );
236+ return ReflectionUtils .getObjectField (phoneUserJidField , waContact );
237+ }
238+ return userJid ;
228239 } else {
229240 return ReflectionUtils .callMethod (groupUserJidMethod , activity );
230241 }
0 commit comments