Skip to content

Commit c56db1a

Browse files
authored
Merge pull request #490 from frknkrc44/fix-25-35-xx
Add 2.25.35.xx support
2 parents 409e1a0 + 61fc09a commit c56db1a

File tree

5 files changed

+42
-6
lines changed

5 files changed

+42
-6
lines changed

app/src/main/java/com/wmods/wppenhacer/xposed/core/WppCore.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,32 @@ public synchronized static Class getTextStatusComposerFragmentClass(@NonNull Cla
334334
throw new Exception("TextStatusComposerFragmentClass not found");
335335
}
336336

337+
public synchronized static Class getVoipManagerClass(@NonNull ClassLoader loader) throws Exception {
338+
var classes = new String[]{
339+
"com.whatsapp.voipcalling.Voip",
340+
"com.whatsapp.calling.voipcalling.Voip"
341+
};
342+
Class<?> result = null;
343+
for (var clazz : classes) {
344+
if ((result = XposedHelpers.findClassIfExists(clazz, loader)) != null)
345+
return result;
346+
}
347+
throw new Exception("VoipManagerClass not found");
348+
}
349+
350+
public synchronized static Class getVoipCallInfoClass(@NonNull ClassLoader loader) throws Exception {
351+
var classes = new String[]{
352+
"com.whatsapp.voipcalling.CallInfo",
353+
"com.whatsapp.calling.infra.voipcalling.CallInfo"
354+
};
355+
Class<?> result = null;
356+
for (var clazz : classes) {
357+
if ((result = XposedHelpers.findClassIfExists(clazz, loader)) != null)
358+
return result;
359+
}
360+
throw new Exception("VoipCallInfoClass not found");
361+
}
362+
337363
// public static Activity getActivityBySimpleName(String name) {
338364
// for (var activity : activities) {
339365
// if (activity.getClass().getSimpleName().equals(name)) {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1985,7 +1985,8 @@ public static Class<?> getClassByName(String className, ClassLoader classLoader)
19851985

19861986
public static Class loadVoipManager(ClassLoader classLoader) throws Exception {
19871987
return UnobfuscatorCache.getInstance().getClass(classLoader, () -> {
1988-
var superClasses = dexkit.findClass(FindClass.create().matcher(ClassMatcher.create().superClass("com.whatsapp.voipcalling.Voip")));
1988+
var voipClass = WppCore.getVoipManagerClass(classLoader);
1989+
var superClasses = dexkit.findClass(FindClass.create().matcher(ClassMatcher.create().superClass(voipClass.getName())));
19891990
if (superClasses.isEmpty())
19901991
throw new ClassNotFoundException("VoipManager Class not found");
19911992
for (var supclass : superClasses) {

app/src/main/java/com/wmods/wppenhacer/xposed/features/privacy/CallPrivacy.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
4343
}
4444
});
4545

46-
var clazzVoip = XposedHelpers.findClass("com.whatsapp.voipcalling.Voip", classLoader);
46+
var clazzVoip = WppCore.getVoipManagerClass(classLoader);
4747
var endCallMethod = ReflectionUtils.findMethodUsingFilter(clazzVoip, m -> m.getName().equals("endCall"));
4848
var rejectCallMethod = ReflectionUtils.findMethodUsingFilter(clazzVoip, m -> m.getName().equals("rejectCall"));
4949

@@ -53,7 +53,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
5353
@Override
5454
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
5555
Object callinfo;
56-
Class<?> callInfoClass = XposedHelpers.findClass("com.whatsapp.voipcalling.CallInfo", classLoader);
56+
Class<?> callInfoClass = WppCore.getVoipCallInfoClass(classLoader);
5757
if (param.args[0] instanceof Message) {
5858
callinfo = ((Message) param.args[0]).obj;
5959
} else if (param.args.length > 1 && callInfoClass.isInstance(param.args[1])) {
@@ -92,7 +92,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
9292
}
9393
});
9494

95-
XposedBridge.hookAllMethods(classLoader.loadClass("com.whatsapp.voipcalling.Voip"), "nativeHandleIncomingXmppOffer", new XC_MethodHook() {
95+
XposedBridge.hookAllMethods(WppCore.getVoipManagerClass(classLoader), "nativeHandleIncomingXmppOffer", new XC_MethodHook() {
9696
@Override
9797
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
9898
if (!prefs.getString("call_type", "no_internet").equals("no_internet")) return;

app/src/main/java/com/wmods/wppenhacer/xposed/features/privacy/HideSeen.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,15 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
5353
return;
5454
}
5555
var lid = (String) XposedHelpers.getObjectField(sendReadReceiptJob, "jid");
56-
var userJid = new FMessageWpp.UserJid(lid);
57-
if (userJid.isNull()) return;
56+
FMessageWpp.UserJid userJid = null;
57+
try {
58+
userJid = new FMessageWpp.UserJid(lid);
59+
if (userJid.isNull()) return;
60+
} catch (Throwable e) {
61+
// WhatsApp crashes when attempting to create UserJid from MeJid or LidMeJid
62+
// and this issue can be ignored since we don't need to hide something from ourself
63+
return;
64+
}
5865
var privacy = CustomPrivacy.getJSON(userJid.getPhoneNumber());
5966

6067
var customHideRead = privacy.optBoolean("HideSeen", hideread);

app/src/main/res/values/arrays.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
<item>2.25.32.xx</item>
130130
<item>2.25.33.xx</item>
131131
<item>2.25.34.xx</item>
132+
<item>2.25.35.xx</item>
132133
</string-array>
133134
<string-array name="supported_versions_business">
134135
<item>2.25.25.xx</item>
@@ -141,6 +142,7 @@
141142
<item>2.25.32.xx</item>
142143
<item>2.25.33.xx</item>
143144
<item>2.25.34.xx</item>
145+
<item>2.25.35.xx</item>
144146
</string-array>
145147
<string-array name="image_picker">
146148
<item>image/*</item>

0 commit comments

Comments
 (0)