Skip to content

Commit 2dbe531

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/master'
2 parents 63205af + 0a9e0e7 commit 2dbe531

File tree

8 files changed

+479
-14
lines changed

8 files changed

+479
-14
lines changed

app/src/main/java/com/wmods/wppenhacer/xposed/core/devkit/Unobfuscator.java

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import java.util.ArrayList;
3939
import java.util.Arrays;
4040
import java.util.Calendar;
41+
import java.util.Collections;
4142
import java.util.Date;
4243
import java.util.HashMap;
4344
import java.util.List;
@@ -835,6 +836,19 @@ public synchronized static Method loadSendPresenceMethod(ClassLoader loader) thr
835836
return UnobfuscatorCache.getInstance().getMethod(loader, () -> {
836837
var method = findFirstMethodUsingStrings(loader, StringMatchType.Contains, "app/send-presence-subscription jid=");
837838
if (method == null) throw new Exception("SendPresence method not found");
839+
840+
// for 22.xx, method returns wrong one
841+
var methodData = dexkit.getMethodData(method);
842+
var groupJidClass = XposedHelpers.findClass("com.whatsapp.jid.GroupJid", loader);
843+
var classCheckMethod = dexkit.findMethod(FindMethod.create()
844+
.searchInClass(Collections.singletonList(methodData.getDeclaredClass()))
845+
.matcher(MethodMatcher.create().returnType(groupJidClass)))
846+
.singleOrNull();
847+
if (classCheckMethod == null) {
848+
var newMethod = methodData.getCallers().firstOrNull();
849+
if (newMethod == null) throw new Exception("SendPresence method not found 2");
850+
return newMethod.getMethodInstance(loader);
851+
}
838852
return method;
839853
});
840854
}
@@ -1211,6 +1225,11 @@ public synchronized static Method loadMaterialAlertDialog(ClassLoader loader) th
12111225
if (invoke.isMethod() && Modifier.isStatic(invoke.getModifiers()) && invoke.getParamCount() == 1 && invoke.getParamTypes().get(0).getName().equals(Context.class.getName())) {
12121226
return invoke.getMethodInstance(loader);
12131227
}
1228+
1229+
// for 22.xx, MaterialAlertDialog method is not static
1230+
if (invoke.isMethod() && invoke.getParamCount() == 1 && invoke.getParamTypes().get(0).getName().equals(Context.class.getName())) {
1231+
return invoke.getMethodInstance(loader);
1232+
}
12141233
}
12151234
throw new RuntimeException("MaterialAlertDialog not found");
12161235
});
@@ -1477,8 +1496,13 @@ public synchronized static Method loadPlaybackSpeed(ClassLoader classLoader) thr
14771496
public synchronized static Constructor loadListUpdateItemsConstructor(ClassLoader classLoader) throws Exception {
14781497
return UnobfuscatorCache.getInstance().getConstructor(classLoader, () -> {
14791498
var method = dexkit.findMethod(new FindMethod().matcher(new MethodMatcher().paramCount(1).returnType(void.class).addParamType(Object.class).addUsingNumber(8686)));
1480-
if (method.isEmpty())
1481-
throw new RuntimeException("ListUpdateItems method not found");
1499+
if (method.isEmpty()) {
1500+
// for 22.xx, use alternative method
1501+
method = dexkit.findMethod(new FindMethod().matcher(new MethodMatcher().paramCount(1).returnType(void.class).addUsingString("deleted", StringMatchType.Equals).addUsingString("membership", StringMatchType.Equals)));
1502+
1503+
if (method.isEmpty())
1504+
throw new RuntimeException("ListUpdateItems method not found");
1505+
}
14821506
return method.get(0).getClassInstance(classLoader).getConstructors()[0];
14831507
});
14841508
}

app/src/main/java/com/wmods/wppenhacer/xposed/features/customization/ShowOnline.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,12 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
149149
Class<?> JidClass = classLoader.loadClass("com.whatsapp.jid.Jid");
150150
var method = ReflectionUtils.findMethodUsingFilter(sendPresenceMethod.getDeclaringClass(), method1 -> method1.getParameterCount() == 2 && JidClass.isAssignableFrom(method1.getParameterTypes()[0]) && method1.getParameterTypes()[1] == sendPresenceMethod.getDeclaringClass());
151151
var instance = ReflectionUtils.callMethod(method, null, jidObject, mInstancePresence); //XposedHelpers.newInstance(clazz, new Object[]{null, null});
152-
sendPresenceMethod.invoke(null, jidObject, instance, mInstancePresence);
152+
// for 22.xx, the parameter count is 4
153+
if (sendPresenceMethod.getParameterCount() == 4) {
154+
sendPresenceMethod.invoke(null, jidObject, null, instance, mInstancePresence);
155+
} else {
156+
sendPresenceMethod.invoke(null, jidObject, instance, mInstancePresence);
157+
}
153158
var status = (String) ReflectionUtils.callMethod(getStatusUser, mStatusUser, object, false);
154159
var currentPosition = (int) ReflectionUtils.callMethod(getAdapterPositionMethod, viewHolder);
155160
if (currentPosition != position) return;

app/src/main/java/com/wmods/wppenhacer/xposed/features/general/Others.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,10 @@ private void showCallInformation(Object wamCall, Object userJid) throws Exceptio
212212
if (WppCore.isGroup(WppCore.getRawString(userJid)))
213213
return;
214214
var sb = new StringBuilder();
215-
216215
var contact = WppCore.getContactName(userJid);
217-
if (!TextUtils.isEmpty(contact))
218-
sb.append("Contact: ").append(contact).append("\n");
219-
sb.append("Number: ").append("+").append(WppCore.stripJID(WppCore.getRawString(userJid))).append("\n");
220-
216+
var number = WppCore.stripJID(WppCore.getRawString(userJid));
217+
if (!TextUtils.isEmpty(contact)) sb.append(String.format(Utils.getApplication().getString(ResId.string.contact_s), contact)).append("\n");
218+
sb.append(String.format(Utils.getApplication().getString(ResId.string.phone_number_s), number)).append("\n");
221219
var ip = (String) XposedHelpers.getObjectField(wamCall, "callPeerIpStr");
222220
if (ip != null) {
223221
var client = new OkHttpClient();
@@ -227,15 +225,15 @@ private void showCallInformation(Object wamCall, Object userJid) throws Exceptio
227225
var json = new JSONObject(content);
228226
var country = json.getString("country");
229227
var city = json.getString("city");
230-
sb.append("Country: ").append(country).append("\n");
231-
sb.append("City: ").append(city).append("\n");
232-
sb.append("IP: ").append(ip).append("\n");
228+
sb.append(String.format(Utils.getApplication().getString(ResId.string.country_s), country)).append("\n")
229+
.append(String.format(Utils.getApplication().getString(ResId.string.city_s), city)).append("\n")
230+
.append(String.format(Utils.getApplication().getString(ResId.string.ip_s), ip)).append("\n");
233231
}
234232
var platform = (String) XposedHelpers.getObjectField(wamCall, "callPeerPlatform");
235-
if (platform != null) sb.append("Platform: ").append(platform).append("\n");
233+
if (platform != null) sb.append(String.format(Utils.getApplication().getString(ResId.string.platform_s), platform)).append("\n");
236234
var wppVersion = (String) XposedHelpers.getObjectField(wamCall, "callPeerAppVersion");
237-
if (wppVersion != null) sb.append("WhatsApp Version: ").append(wppVersion).append("\n");
238-
Utils.showNotification("Call Information", sb.toString());
235+
if (wppVersion != null) sb.append(String.format(Utils.getApplication().getString(ResId.string.wpp_version_s), wppVersion)).append("\n");
236+
Utils.showNotification(Utils.getApplication().getString(ResId.string.call_information), sb.toString());
239237
}
240238

241239
private void alwaysOnline() throws Exception {

app/src/main/java/com/wmods/wppenhacer/xposed/utils/ResId.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ public static class string {
9191
public static int custom_privacy;
9292
public static int custom_privacy_sum;
9393
public static int block_call;
94+
public static int contact_s;
95+
public static int phone_number_s;
96+
public static int country_s;
97+
public static int city_s;
98+
public static int ip_s;
99+
public static int platform_s;
100+
public static int wpp_version_s;
101+
public static int call_information;
94102
}
95103

96104
public static class array {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string-array name="animations_names">
4+
<item>默认</item>
5+
<item>淡入</item>
6+
<item>淡出</item>
7+
<item>放大</item>
8+
<item>向上滑动</item>
9+
<item>从右向左滑动</item>
10+
<item>旋转</item>
11+
<item>弹跳</item>
12+
<item>缩小</item>
13+
<item>翻转</item>
14+
<item>超空间消失</item>
15+
</string-array>
16+
</resources>

0 commit comments

Comments
 (0)