File tree Expand file tree Collapse file tree
java/com/wmods/wppenhacer/xposed Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ class WaContactWpp(instance: Any?) {
3232 private var fieldContactData: Field ? = null
3333 private var fieldUserJid: Field ? = null
3434 private var fieldGetWaName: Field ? = null
35+ private var fieldNumber: Field ? = null
3536 private var fieldDataGetDisplayName: Field ? = null
3637 private var fieldWaContactInData: Field ? = null
3738
@@ -90,6 +91,8 @@ class WaContactWpp(instance: Any?) {
9091 })
9192 }
9293
94+ fieldNumber = Unobfuscator .loadWaContactNumberField(classLoader)
95+
9396 fieldWaContactInData = fieldContactData!! .type.declaredFields.first {
9497 it.type == TYPE
9598 }
@@ -155,7 +158,6 @@ class WaContactWpp(instance: Any?) {
155158 }
156159 }
157160
158-
159161 val waContactData: Any? by lazy {
160162 try {
161163 fieldContactData?.get(mInstance)
@@ -178,5 +180,13 @@ class WaContactWpp(instance: Any?) {
178180 }
179181 }
180182
183+ fun isSavedContact (): Boolean {
184+ return try {
185+ fieldNumber?.get(mInstance) != null || fieldWaContactInData?.get(waContactData) != null
186+ } catch (e: Exception ) {
187+ XposedBridge .log(e)
188+ false
189+ }
190+ }
181191
182192}
Original file line number Diff line number Diff line change @@ -2939,16 +2939,23 @@ public static Field loadGetCurrentPageInHomeField(@NotNull ClassLoader classLoad
29392939
29402940 }
29412941
2942- public static Method loadHideMeTabIcon (@ NotNull ClassLoader classLoader ) throws Exception {
2943- return UnobfuscatorCache .getInstance ().getMethod (classLoader , ()->{
2944- return dexkit .findMethod (
2945- FindMethod .create ().matcher (
2946- MethodMatcher .create ()
2947- .addUsingString ("is_biz_alerts_eligible" )
2948- .paramCount (1 )
2949- .paramTypes (Menu .class )
2950- )
2951- ).first ().getMethodInstance (classLoader );
2942+ public static @ Nullable Field loadWaContactNumberField (@ NonNull ClassLoader classLoader ) throws Exception {
2943+ return UnobfuscatorCache .getInstance ().getField (classLoader ,()-> {
2944+ var waContact = loadWaContactClass (classLoader );
2945+ var waContactData = dexkit .getClassData (waContact );
2946+ if (waContactData == null )throw new NoSuchFieldException ("WaContact class data not found" );
2947+
2948+ var methodData = waContactData .findMethod (FindMethod .create ().matcher (MethodMatcher .create ()
2949+ .usingNumbers (-4 ,0 )
2950+ .returnType (long .class )
2951+ )).firstOrNull ();
2952+ if (methodData == null ) throw new NoSuchFieldException ("Number Method not found!" );
2953+ for (var ufield : methodData .getUsingFields ()){
2954+ var field = ufield .getField ().getFieldInstance (classLoader );
2955+ if (field .getDeclaringClass ().equals (waContact ) && !field .getType ().isPrimitive ())
2956+ return field ;
2957+ }
2958+ return null ;
29522959 });
29532960 }
29542961}
You can’t perform that action at this time.
0 commit comments