Skip to content

Commit 30e5d30

Browse files
committed
feat: add support for version 2.26.13.xx
1 parent b0bb0ce commit 30e5d30

File tree

5 files changed

+72
-56
lines changed

5 files changed

+72
-56
lines changed

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

Lines changed: 51 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -227,25 +227,39 @@ public synchronized static Method loadGhostModeMethod(ClassLoader classLoader) t
227227

228228
// TODO: Classes and Methods for Receipt
229229

230-
public synchronized static Method loadReceiptMethod(ClassLoader classLoader) throws Exception {
230+
public static Method loadReceiptMethod(ClassLoader classLoader) throws Exception {
231231
return UnobfuscatorCache.getInstance().getMethod(classLoader, () -> {
232-
var classDeviceJid = Unobfuscator.findFirstClassUsingName(classLoader, StringMatchType.EndsWith,
233-
"jid.DeviceJid");
234-
var classPhoneUserJid = Unobfuscator.findFirstClassUsingName(classLoader, StringMatchType.EndsWith,
235-
"jid.PhoneUserJid");
232+
var classDeviceJid = Unobfuscator.findFirstClassUsingName(
233+
classLoader, StringMatchType.EndsWith, "jid.DeviceJid");
234+
var classPhoneUserJid = Unobfuscator.findFirstClassUsingName(
235+
classLoader, StringMatchType.EndsWith, "jid.PhoneUserJid");
236+
var classProtocolTreeNode = findFirstClassUsingStrings(
237+
classLoader, StringMatchType.Contains, "ProtocolTreeNode/getAttributeJid");
238+
236239
var methods = dexkit.findMethod(
237240
FindMethod.create()
238241
.matcher(MethodMatcher.create()
239242
.addUsingString("receipt")
240-
.paramCount(5, 8)));
243+
.returnType(classProtocolTreeNode))
244+
);
241245

242246
for (var method : methods) {
243247
var params = method.getParamTypeNames();
244-
if (params.contains(classDeviceJid.getName()) && params.contains(classPhoneUserJid.getName()))
245-
return method.getMethodInstance(classLoader);
248+
249+
boolean hasRequiredParams =
250+
params.contains(classDeviceJid.getName()) &&
251+
params.contains(classPhoneUserJid.getName());
252+
253+
if (!hasRequiredParams) continue;
254+
255+
return method.getMethodInstance(classLoader);
246256
}
247257

248-
throw new NoSuchMethodError("Receipt method not found");
258+
throw new NoSuchMethodError(
259+
"Receipt method not found. returnType=" + classProtocolTreeNode.getName()
260+
+ ", requiredParams=[" + classDeviceJid.getName()
261+
+ ", " + classPhoneUserJid.getName() + "]"
262+
);
249263
});
250264
}
251265

@@ -929,22 +943,19 @@ public synchronized static Field loadMessageKeyField(ClassLoader loader) throws
929943
});
930944
}
931945

932-
public synchronized static Class<?> loadConversationRowClass(ClassLoader loader) throws Exception {
946+
947+
public static Class<?> loadConversationRowClass(ClassLoader loader) throws Exception {
933948
return UnobfuscatorCache.getInstance().getClass(loader, () -> {
934-
var clazz = findFirstClassUsingStrings(loader, StringMatchType.Contains,
935-
"ConversationRow/setupUserNameInGroupView/");
936-
if (clazz != null)
937-
return clazz;
938-
var conversation_header = Utils.getID("conversation_row_participant_header_view_stub", "id");
939-
var nameId = Utils.getID("name_in_group", "id");
940-
var classData = dexkit
941-
.findClass(FindClass.create()
942-
.matcher(ClassMatcher.create().addMethod(
943-
MethodMatcher.create().addUsingNumber(conversation_header).addUsingNumber(nameId))))
944-
.singleOrNull();
945-
if (classData == null)
946-
throw new Exception("ConversationRow class not found");
947-
return classData.getInstance(loader);
949+
var clazz = findFirstClassUsingStrings(loader, StringMatchType.Contains, "ConversationRow/setupUserNameInGroupView/");
950+
if (clazz != null) return clazz;
951+
var conversation_header = Utils.getID("name_in_group", "id");
952+
var classData = dexkit.findClass(FindClass.create().matcher(ClassMatcher.create().addMethod(MethodMatcher.create().addUsingNumber(conversation_header))));
953+
for (ClassData c : classData) {
954+
var clazzInstance = c.getInstance(loader);
955+
if (ViewGroup.class.isAssignableFrom(clazzInstance))
956+
return clazzInstance;
957+
}
958+
return null;
948959
});
949960
}
950961

@@ -1886,13 +1897,19 @@ public synchronized static Method loadShowDialogStatusMethod(ClassLoader classLo
18861897
});
18871898
}
18881899

1889-
public synchronized static Method loadPlaybackSpeed(ClassLoader classLoader) throws Exception {
1900+
public static Method loadPlaybackSpeed(ClassLoader classLoader) throws Exception {
18901901
return UnobfuscatorCache.getInstance().getMethod(classLoader, () -> {
1891-
var method = findFirstMethodUsingStrings(classLoader, StringMatchType.Contains,
1892-
"heroaudioplayer/setPlaybackSpeed");
1893-
if (method == null)
1894-
throw new RuntimeException("PlaybackSpeed method not found");
1895-
return method;
1902+
var method = findFirstMethodUsingStrings(classLoader, StringMatchType.Contains, "heroaudioplayer/setPlaybackSpeed");
1903+
if (method != null) return method;
1904+
1905+
var methodData = dexkit.findMethod(
1906+
FindMethod.create().matcher(
1907+
MethodMatcher.create().addUsingString("setPlaybackSpeed", StringMatchType.Equals).addUsingString("newSpeed")
1908+
)
1909+
).singleOrNull();
1910+
1911+
if (methodData == null) throw new RuntimeException("PlaybackSpeed method not found");
1912+
return methodData.getMethodInstance(classLoader);
18961913
});
18971914
}
18981915

@@ -2772,4 +2789,8 @@ public static Class<?> loadGetProfilePhoto(ClassLoader classLoader) throws Excep
27722789
public static Class<?> loadDialerProfilePictureLoader(ClassLoader classLoader) throws Exception {
27732790
return UnobfuscatorCache.getInstance().getClass(classLoader, () -> findFirstClassUsingStrings(classLoader, StringMatchType.Contains, "DialerProfilePictureLoader/syncFetchProfilePhoto/onPhotoReceived"));
27742791
}
2792+
2793+
public static Class<?> loadBottomBarConfigClass(ClassLoader classLoader) throws Exception {
2794+
return UnobfuscatorCache.getInstance().getClass(classLoader, () -> findFirstClassUsingStrings(classLoader, StringMatchType.Contains, "BottomBarConfig("));
2795+
}
27752796
}

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -326,18 +326,7 @@ private void hookViewOnceScreen(int ticktype) throws Exception {
326326
@Override
327327
@SuppressLint("DiscouragedApi")
328328
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
329-
var messageField = ReflectionUtils.getFieldByExtendType(menuMethod.getDeclaringClass(), FMessageWpp.TYPE);
330-
Object fmessageObj = null;
331-
if (messageField != null) {
332-
fmessageObj = messageField.get(param.thisObject);
333-
}
334-
if (fmessageObj == null) {
335-
var keyField = ReflectionUtils.getFieldByExtendType(param.thisObject.getClass(), FMessageWpp.Key.TYPE);
336-
if (keyField != null) {
337-
var keyObj = keyField.get(param.thisObject);
338-
fmessageObj = WppCore.getFMessageFromKey(keyObj);
339-
}
340-
}
329+
var fmessageObj = ReflectionUtils.getArg(param.args, FMessageWpp.TYPE, 0);
341330
FMessageWpp fMessage = new FMessageWpp(fmessageObj);
342331
if (!fMessage.isViewOnce()) return;
343332
Menu menu = (Menu) param.args[0];

app/src/main/java/com/wmods/wppenhacer/xposed/features/media/DownloadViewOnce.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,7 @@ public void doHook() throws Throwable {
5151
@Override
5252
@SuppressLint("DiscouragedApi")
5353
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
54-
var fmessageField = ReflectionUtils.getFieldByExtendType(param.thisObject.getClass(), FMessageWpp.TYPE);
55-
Object fmessageObj = null;
56-
if (fmessageField != null) {
57-
fmessageObj = fmessageField.get(param.thisObject);
58-
}
59-
if (fmessageObj == null) {
60-
var keyField = ReflectionUtils.getFieldByExtendType(param.thisObject.getClass(), FMessageWpp.Key.TYPE);
61-
if (keyField != null) {
62-
var keyObj = keyField.get(param.thisObject);
63-
fmessageObj = WppCore.getFMessageFromKey(keyObj);
64-
}
65-
}
54+
var fmessageObj = ReflectionUtils.getArg(param.args, FMessageWpp.TYPE, 0);
6655
FMessageWpp fMessage = new FMessageWpp(fmessageObj);
6756

6857
// check media is view once

app/src/main/java/com/wmods/wppenhacer/xposed/features/media/MediaQuality.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,23 @@ public void doHook() throws Exception {
5353
Others.propsBoolean.put(14447, false);
5454

5555
// Enable Media Quality selection for Stories
56-
var hookMediaQualitySelection = Unobfuscator.loadMediaQualitySelectionMethod(classLoader);
57-
XposedBridge.hookMethod(hookMediaQualitySelection, XC_MethodReplacement.returnConstant(true));
56+
try {
57+
var hookMediaQualitySelection = Unobfuscator.loadMediaQualitySelectionMethod(classLoader);
58+
XposedBridge.hookMethod(hookMediaQualitySelection, XC_MethodReplacement.returnConstant(true));
59+
} catch (Exception ignored) {
60+
var BottomBarConfigClass = Unobfuscator.loadBottomBarConfigClass(classLoader);
61+
var fieldsBottomBarConfig = Unobfuscator.getAllMapFields(BottomBarConfigClass);
62+
63+
XposedBridge.hookAllConstructors(BottomBarConfigClass, new XC_MethodHook() {
64+
@Override
65+
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
66+
var supportsHdQuality = fieldsBottomBarConfig.get("supportsHdQuality");
67+
if (supportsHdQuality != null) {
68+
supportsHdQuality.set(param.thisObject, true);
69+
}
70+
}
71+
});
72+
}
5873

5974
if (videoQuality) {
6075
Others.propsBoolean.put(5549, true);

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,15 @@
159159
<item>2.26.10.xx</item>
160160
<item>2.26.11.xx</item>
161161
<item>2.26.12.xx</item>
162+
<item>2.26.13.xx</item>
162163
</string-array>
163164
<string-array name="supported_versions_business">
164165
<item>2.26.8.xx</item>
165166
<item>2.26.9.xx</item>
166167
<item>2.26.10.xx</item>
167168
<item>2.26.11.xx</item>
168169
<item>2.26.12.xx</item>
170+
<item>2.26.13.xx</item>
169171
</string-array>
170172
<string-array name="image_picker">
171173
<item>image/*</item>

0 commit comments

Comments
 (0)