Skip to content

Commit d064bb7

Browse files
committed
feat: Add 2.25.15.xx support
1 parent af5dc8c commit d064bb7

File tree

5 files changed

+58
-26
lines changed

5 files changed

+58
-26
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,14 @@ public synchronized static Class getDataUsageActivityClass(@NonNull ClassLoader
262262
: XposedHelpers.findClass("com.whatsapp.settings.ui.SettingsDataUsageActivity", loader);
263263
}
264264

265+
public synchronized static Class getTextStatusComposerFragmentClass(@NonNull ClassLoader loader) {
266+
Class oldClass = XposedHelpers.findClassIfExists("com.whatsapp.statuscomposer.composer.TextStatusComposerFragment", loader);
267+
268+
return oldClass != null
269+
? oldClass
270+
: XposedHelpers.findClass("com.whatsapp.status.composer.composer.TextStatusComposerFragment", loader);
271+
}
272+
265273
// public static Activity getActivityBySimpleName(String name) {
266274
// for (var activity : activities) {
267275
// 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
@@ -1356,6 +1356,7 @@ public synchronized static Method loadAudioProximitySensorMethod(ClassLoader loa
13561356

13571357
public synchronized static Method loadGroupAdminMethod(ClassLoader loader) throws Exception {
13581358
var method = findFirstMethodUsingStrings(loader, StringMatchType.Contains, "P Message");
1359+
if (method == null) method = findFirstMethodUsingStrings(loader, StringMatchType.Contains, "ConversationRow/setUpUsernameInGroupViewContainer/not allowed state");
13591360
if (method == null) throw new RuntimeException("GroupAdmin method not found");
13601361
return method;
13611362
}
@@ -1624,7 +1625,7 @@ public synchronized static Method loadTextStatusComposer2(ClassLoader classLoade
16241625
addMethod(MethodMatcher.create().paramCount(1).addParamType(TextDataClass))
16251626
));
16261627
if (result.isEmpty()) {
1627-
var tscClazzData = dexkit.getClassData("com.whatsapp.statuscomposer.composer.TextStatusComposerFragment");
1628+
var tscClazzData = dexkit.getClassData(WppCore.getTextStatusComposerFragmentClass(classLoader));
16281629
if (tscClazzData != null) {
16291630
for (var method : tscClazzData.getMethods()) {
16301631
var tdMethod = method.getInvokes().stream().filter(m -> m.isMethod() && m.getParamCount() == 1 && m.getParamTypes().get(0).equals(dexkit.getClassData(TextDataClass))).findFirst();

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

Lines changed: 45 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -74,30 +74,51 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
7474
}
7575
if (showOnlineIcon) {
7676
var contactView = (FrameLayout) view.findViewById(Utils.getID("contact_selector", "id"));
77-
var photoView = (ImageView) contactView.getChildAt(0);
78-
contactView.removeView(photoView);
79-
80-
var relativeLayout = new RelativeLayout(context);
81-
relativeLayout.setId(0x7FFF0003);
82-
var params = new RelativeLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
83-
params.addRule(RelativeLayout.CENTER_IN_PARENT);
84-
photoView.setLayoutParams(params);
85-
relativeLayout.addView(photoView);
86-
contactView.addView(relativeLayout);
77+
var firstChild = contactView.getChildAt(0);
8778
var isLeftToRight = TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_LTR;
88-
89-
var imageView = new ImageView(context);
90-
imageView.setId(0x7FFF0001);
91-
var params2 = new RelativeLayout.LayoutParams(Utils.dipToPixels(14), Utils.dipToPixels(14));
92-
params2.addRule(RelativeLayout.ALIGN_TOP, contactView.getId());
93-
params2.addRule(isLeftToRight ? RelativeLayout.ALIGN_RIGHT : RelativeLayout.ALIGN_LEFT, photoView.getId());
94-
params2.topMargin = Utils.dipToPixels(5);
95-
imageView.setLayoutParams(params2);
96-
imageView.setImageResource(ResId.drawable.online);
97-
imageView.setAdjustViewBounds(true);
98-
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
99-
imageView.setVisibility(View.INVISIBLE);
100-
relativeLayout.addView(imageView);
79+
if (firstChild instanceof ImageView photoView) {
80+
contactView.removeView(photoView);
81+
82+
var relativeLayout = new RelativeLayout(context);
83+
relativeLayout.setId(0x7FFF0003);
84+
var params = new RelativeLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
85+
params.addRule(RelativeLayout.CENTER_IN_PARENT);
86+
photoView.setLayoutParams(params);
87+
relativeLayout.addView(photoView);
88+
contactView.addView(relativeLayout);
89+
90+
var imageView = new ImageView(context);
91+
imageView.setId(0x7FFF0001);
92+
var params2 = new RelativeLayout.LayoutParams(Utils.dipToPixels(14), Utils.dipToPixels(14));
93+
params2.addRule(RelativeLayout.ALIGN_TOP, contactView.getId());
94+
params2.addRule(isLeftToRight ? RelativeLayout.ALIGN_RIGHT : RelativeLayout.ALIGN_LEFT, photoView.getId());
95+
params2.topMargin = Utils.dipToPixels(5);
96+
imageView.setLayoutParams(params2);
97+
imageView.setImageResource(ResId.drawable.online);
98+
imageView.setAdjustViewBounds(true);
99+
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
100+
imageView.setVisibility(View.INVISIBLE);
101+
relativeLayout.addView(imageView);
102+
} else if (firstChild instanceof RelativeLayout relativeLayout) {
103+
var photoView = (ImageView) relativeLayout.getChildAt(0);
104+
105+
var params = new RelativeLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
106+
params.addRule(RelativeLayout.CENTER_IN_PARENT);
107+
photoView.setLayoutParams(params);
108+
109+
var imageView = new ImageView(context);
110+
imageView.setId(0x7FFF0001);
111+
var params2 = new RelativeLayout.LayoutParams(Utils.dipToPixels(14), Utils.dipToPixels(14));
112+
params2.addRule(RelativeLayout.ALIGN_TOP, contactView.getId());
113+
params2.addRule(isLeftToRight ? RelativeLayout.ALIGN_RIGHT : RelativeLayout.ALIGN_LEFT, photoView.getId());
114+
params2.topMargin = Utils.dipToPixels(5);
115+
imageView.setLayoutParams(params2);
116+
imageView.setImageResource(ResId.drawable.online);
117+
imageView.setAdjustViewBounds(true);
118+
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
119+
imageView.setVisibility(View.INVISIBLE);
120+
relativeLayout.addView(imageView);
121+
}
101122
}
102123
}
103124
});
@@ -144,7 +165,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
144165

145166
var getAdapterPositionMethod = ReflectionUtils.findMethodUsingFilter(absViewHolderClass, method -> method.getParameterCount() == 0 && method.getReturnType() == int.class);
146167
var position = (int) ReflectionUtils.callMethod(getAdapterPositionMethod, viewHolder);
147-
ImageView csDot = showOnlineIcon ? view.findViewById(0x7FFF0003).findViewById(0x7FFF0001) : null;
168+
ImageView csDot = showOnlineIcon ? view.findViewById(0x7FFF0001) : null;
148169
if (showOnlineIcon) {
149170
csDot.setVisibility(View.INVISIBLE);
150171
}

app/src/main/java/com/wmods/wppenhacer/xposed/features/others/TextStatusComposer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
6060
});
6161
}
6262

63-
var clazz = XposedHelpers.findClass("com.whatsapp.statuscomposer.composer.TextStatusComposerFragment", classLoader);
63+
var clazz = WppCore.getTextStatusComposerFragmentClass(classLoader);
6464
var methodOnCreate = ReflectionUtils.findMethodUsingFilter(clazz, method -> method.getParameterCount() == 2 && method.getParameterTypes()[0] == Bundle.class && method.getParameterTypes()[1] == View.class);
6565
XposedBridge.hookMethod(methodOnCreate,
6666
new XC_MethodHook() {

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.12.xx</item>
130130
<item>2.25.13.xx</item>
131131
<item>2.25.14.xx</item>
132+
<item>2.25.15.xx</item>
132133
</string-array>
133134
<string-array name="supported_versions_business">
134135
<item>2.25.5.xx</item>
@@ -141,6 +142,7 @@
141142
<item>2.25.12.xx</item>
142143
<item>2.25.13.xx</item>
143144
<item>2.25.14.xx</item>
145+
<item>2.25.15.xx</item>
144146
</string-array>
145147
<string-array name="image_picker">
146148
<item>image/*</item>

0 commit comments

Comments
 (0)