From 00c77f21e06c1debf966ae50f7801bf00fbbb285 Mon Sep 17 00:00:00 2001 From: frknkrc44 Date: Tue, 11 Mar 2025 17:09:50 +0300 Subject: [PATCH] feat: Add 25.6.xx support --- .../wppenhacer/xposed/core/FeatureLoader.java | 2 +- .../wmods/wppenhacer/xposed/core/WppCore.java | 18 +++++++++++++++++- .../xposed/core/devkit/Unobfuscator.java | 3 ++- .../features/customization/CustomThemeV2.java | 10 ++++------ .../features/customization/CustomToolbar.java | 4 ++-- .../features/customization/HideTabs.java | 7 ++++--- .../features/customization/SeparateGroup.java | 3 ++- .../xposed/features/general/ChatLimit.java | 3 ++- .../xposed/features/general/LiteMode.java | 2 +- .../xposed/features/general/NewChat.java | 3 ++- .../xposed/features/general/Others.java | 2 +- .../xposed/features/others/Channels.java | 3 ++- .../xposed/features/others/MenuHome.java | 2 +- app/src/main/res/values/arrays.xml | 2 ++ 14 files changed, 43 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/com/wmods/wppenhacer/xposed/core/FeatureLoader.java b/app/src/main/java/com/wmods/wppenhacer/xposed/core/FeatureLoader.java index ee3488cc..9b4e443d 100644 --- a/app/src/main/java/com/wmods/wppenhacer/xposed/core/FeatureLoader.java +++ b/app/src/main/java/com/wmods/wppenhacer/xposed/core/FeatureLoader.java @@ -155,7 +155,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable { } }); - XposedHelpers.findAndHookMethod("com.whatsapp.HomeActivity", loader, "onCreate", Bundle.class, new XC_MethodHook() { + XposedHelpers.findAndHookMethod(WppCore.getHomeActivityClass(loader), "onCreate", Bundle.class, new XC_MethodHook() { @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { super.afterHookedMethod(param); diff --git a/app/src/main/java/com/wmods/wppenhacer/xposed/core/WppCore.java b/app/src/main/java/com/wmods/wppenhacer/xposed/core/WppCore.java index 7a33fa5b..bc8bf8df 100644 --- a/app/src/main/java/com/wmods/wppenhacer/xposed/core/WppCore.java +++ b/app/src/main/java/com/wmods/wppenhacer/xposed/core/WppCore.java @@ -207,6 +207,22 @@ public static Activity getCurrentActivity() { return mCurrentActivity; } + public synchronized static Class getHomeActivityClass(@NonNull ClassLoader loader) { + Class oldHomeClass = XposedHelpers.findClassIfExists("com.whatsapp.HomeActivity", loader); + + return oldHomeClass != null + ? oldHomeClass + : XposedHelpers.findClass("com.whatsapp.home.ui.HomeActivity", loader); + } + + public synchronized static Class getTabsPagerClass(@NonNull ClassLoader loader) { + Class oldHomeClass = XposedHelpers.findClassIfExists("com.whatsapp.TabsPager", loader); + + return oldHomeClass != null + ? oldHomeClass + : XposedHelpers.findClass("com.whatsapp.home.ui.TabsPager", loader); + } + // public static Activity getActivityBySimpleName(String name) { // for (var activity : activities) { // if (activity.getClass().getSimpleName().equals(name)) { @@ -386,7 +402,7 @@ public static Activity getCurrentConversation() { // for tablet UI, they're using HomeActivity instead of Conversation // TODO: Add more checks for ConversationFragment - Class home = XposedHelpers.findClass("com.whatsapp.HomeActivity", mCurrentActivity.getClassLoader()); + Class home = getHomeActivityClass(mCurrentActivity.getClassLoader()); if (mCurrentActivity.getResources().getConfiguration().smallestScreenWidthDp >= 600 && home.isInstance(mCurrentActivity)) return mCurrentActivity; return null; diff --git a/app/src/main/java/com/wmods/wppenhacer/xposed/core/devkit/Unobfuscator.java b/app/src/main/java/com/wmods/wppenhacer/xposed/core/devkit/Unobfuscator.java index 3c405d3a..fd3be5eb 100644 --- a/app/src/main/java/com/wmods/wppenhacer/xposed/core/devkit/Unobfuscator.java +++ b/app/src/main/java/com/wmods/wppenhacer/xposed/core/devkit/Unobfuscator.java @@ -15,6 +15,7 @@ import android.widget.FrameLayout; import android.widget.TextView; +import com.wmods.wppenhacer.xposed.core.WppCore; import com.wmods.wppenhacer.xposed.utils.ReflectionUtils; import com.wmods.wppenhacer.xposed.utils.Utils; @@ -1860,7 +1861,7 @@ public static Method loadChangeTitleLogoMethod(ClassLoader classLoader) throws E public static Field loadChangeTitleLogoField(ClassLoader classLoader) throws Exception { return UnobfuscatorCache.getInstance().getField(classLoader, () -> { var methodData = dexkit.getMethodData(loadChangeTitleLogoMethod(classLoader)); - var clazz = XposedHelpers.findClass("com.whatsapp.HomeActivity", classLoader); + var clazz = WppCore.getHomeActivityClass(classLoader); var usingFields = methodData.getUsingFields(); for (var uField : usingFields) { var field = uField.getField().getFieldInstance(classLoader); diff --git a/app/src/main/java/com/wmods/wppenhacer/xposed/features/customization/CustomThemeV2.java b/app/src/main/java/com/wmods/wppenhacer/xposed/features/customization/CustomThemeV2.java index 00ea0cdf..a2aed4bd 100644 --- a/app/src/main/java/com/wmods/wppenhacer/xposed/features/customization/CustomThemeV2.java +++ b/app/src/main/java/com/wmods/wppenhacer/xposed/features/customization/CustomThemeV2.java @@ -112,8 +112,8 @@ private void hookWallpaper() throws Exception { replaceTransparency(toolbarAlpha, (100 - wallpaperToolbarAlpha) / 100.0f); } - var clazz = XposedHelpers.findClass("com.whatsapp.HomeActivity", classLoader); - XposedHelpers.findAndHookMethod(clazz, "onCreate", Bundle.class, new XC_MethodHook() { + var homeActivityClass = WppCore.getHomeActivityClass(classLoader); + XposedHelpers.findAndHookMethod(homeActivityClass, "onCreate", Bundle.class, new XC_MethodHook() { @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { var activity = (Activity) param.thisObject; @@ -125,10 +125,8 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable { var revertWallAlpha = revertColors(wallAlpha); - var homeClass = XposedHelpers.findClass("com.whatsapp.HomeActivity", classLoader); - WppCore.addListenerActivity((activity, type) -> { - var isHome = homeClass.isInstance(activity); + var isHome = homeActivityClass.isInstance(activity); if (WppCore.ActivityChangeState.ChangeType.RESUMED == type && isHome) { mMainContainer = activity.findViewById(android.R.id.content); if (mMainContainer != null) { @@ -275,7 +273,7 @@ private void injectWallpaper(View view) { } private boolean checkNotHomeActivity() { - var homeClass = XposedHelpers.findClass("com.whatsapp.HomeActivity", classLoader); + var homeClass = WppCore.getHomeActivityClass(classLoader); var currentActivity = WppCore.getCurrentActivity(); return (currentActivity == null || !homeClass.isInstance(currentActivity)); } diff --git a/app/src/main/java/com/wmods/wppenhacer/xposed/features/customization/CustomToolbar.java b/app/src/main/java/com/wmods/wppenhacer/xposed/features/customization/CustomToolbar.java index 6f4f87d5..fc70f34d 100644 --- a/app/src/main/java/com/wmods/wppenhacer/xposed/features/customization/CustomToolbar.java +++ b/app/src/main/java/com/wmods/wppenhacer/xposed/features/customization/CustomToolbar.java @@ -51,7 +51,7 @@ public void doHook() throws Exception { var typeArchive = prefs.getString("typearchive", "0"); onMenuItemSelected = Unobfuscator.loadOnMenuItemSelected(classLoader); var methodHook = new MethodHook(showName, showBio, typeArchive); - XposedHelpers.findAndHookMethod("com.whatsapp.HomeActivity", classLoader, "onCreate", Bundle.class, methodHook); + XposedHelpers.findAndHookMethod(WppCore.getHomeActivityClass(classLoader), "onCreate", Bundle.class, methodHook); expirationAboutInfo(); Others.propsBoolean.put(6481, false); } @@ -113,7 +113,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable { var name = WppCore.getMyName(); var bio = WppCore.getMyBio(); var window = (ViewGroup) homeActivity.getWindow().getDecorView(); - var clazz = XposedHelpers.findClass("com.whatsapp.TabsPager", homeActivity.getClassLoader()); + var clazz = WppCore.getTabsPagerClass(homeActivity.getClassLoader()); var fieldTab = ReflectionUtils.getFieldByType(homeActivity.getClass(), clazz); var mTabInstance = fieldTab.get(homeActivity); diff --git a/app/src/main/java/com/wmods/wppenhacer/xposed/features/customization/HideTabs.java b/app/src/main/java/com/wmods/wppenhacer/xposed/features/customization/HideTabs.java index 9d64fcef..f6eace67 100644 --- a/app/src/main/java/com/wmods/wppenhacer/xposed/features/customization/HideTabs.java +++ b/app/src/main/java/com/wmods/wppenhacer/xposed/features/customization/HideTabs.java @@ -10,6 +10,7 @@ import androidx.annotation.NonNull; import com.wmods.wppenhacer.xposed.core.Feature; +import com.wmods.wppenhacer.xposed.core.WppCore; import com.wmods.wppenhacer.xposed.core.devkit.Unobfuscator; import com.wmods.wppenhacer.xposed.utils.ReflectionUtils; @@ -37,7 +38,7 @@ public void doHook() throws Throwable { if (hidetabs == null || hidetabs.isEmpty()) return; - var home = XposedHelpers.findClass("com.whatsapp.HomeActivity", classLoader); + var home = WppCore.getHomeActivityClass(classLoader); var hideTabsList = hidetabs.stream().map(Integer::valueOf).collect(Collectors.toList()); @@ -93,10 +94,10 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable { } }); - XposedHelpers.findAndHookMethod("com.whatsapp.HomeActivity", classLoader, "onCreate", Bundle.class, new XC_MethodHook() { + XposedHelpers.findAndHookMethod(WppCore.getHomeActivityClass(classLoader), "onCreate", Bundle.class, new XC_MethodHook() { @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { - Class TabsPagerClass = classLoader.loadClass("com.whatsapp.TabsPager"); + Class TabsPagerClass = WppCore.getTabsPagerClass(classLoader); var tabsField = ReflectionUtils.getFieldByType(param.thisObject.getClass(), TabsPagerClass); mTabPagerInstance = tabsField.get(param.thisObject); } diff --git a/app/src/main/java/com/wmods/wppenhacer/xposed/features/customization/SeparateGroup.java b/app/src/main/java/com/wmods/wppenhacer/xposed/features/customization/SeparateGroup.java index 4916bdc4..81307ccf 100644 --- a/app/src/main/java/com/wmods/wppenhacer/xposed/features/customization/SeparateGroup.java +++ b/app/src/main/java/com/wmods/wppenhacer/xposed/features/customization/SeparateGroup.java @@ -12,6 +12,7 @@ import androidx.annotation.NonNull; import com.wmods.wppenhacer.xposed.core.Feature; +import com.wmods.wppenhacer.xposed.core.WppCore; import com.wmods.wppenhacer.xposed.core.db.MessageStore; import com.wmods.wppenhacer.xposed.core.devkit.Unobfuscator; import com.wmods.wppenhacer.xposed.core.devkit.UnobfuscatorCache; @@ -47,7 +48,7 @@ public SeparateGroup(ClassLoader loader, XSharedPreferences preferences) { public void doHook() throws Exception { var cFragClass = XposedHelpers.findClass("com.whatsapp.conversationslist.ConversationsFragment", classLoader); - var homeActivityClass = XposedHelpers.findClass("com.whatsapp.HomeActivity", classLoader); + var homeActivityClass = WppCore.getHomeActivityClass(classLoader); if (!prefs.getBoolean("separategroups", false)) return; diff --git a/app/src/main/java/com/wmods/wppenhacer/xposed/features/general/ChatLimit.java b/app/src/main/java/com/wmods/wppenhacer/xposed/features/general/ChatLimit.java index 8d5dd815..63688023 100644 --- a/app/src/main/java/com/wmods/wppenhacer/xposed/features/general/ChatLimit.java +++ b/app/src/main/java/com/wmods/wppenhacer/xposed/features/general/ChatLimit.java @@ -6,6 +6,7 @@ import androidx.annotation.NonNull; import com.wmods.wppenhacer.xposed.core.Feature; +import com.wmods.wppenhacer.xposed.core.WppCore; import com.wmods.wppenhacer.xposed.core.db.MessageStore; import com.wmods.wppenhacer.xposed.core.devkit.Unobfuscator; import com.wmods.wppenhacer.xposed.utils.ReflectionUtils; @@ -34,7 +35,7 @@ public void doHook() throws Throwable { var epUpdateMethod = Unobfuscator.loadEphemeralInsertdb(classLoader); - XposedHelpers.findAndHookMethod("com.whatsapp.HomeActivity", classLoader, "onCreate", Bundle.class, new XC_MethodHook() { + XposedHelpers.findAndHookMethod(WppCore.getHomeActivityClass(classLoader), "onCreate", Bundle.class, new XC_MethodHook() { @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { if (antiDisappearing) { diff --git a/app/src/main/java/com/wmods/wppenhacer/xposed/features/general/LiteMode.java b/app/src/main/java/com/wmods/wppenhacer/xposed/features/general/LiteMode.java index b75aa33c..729cb3e3 100644 --- a/app/src/main/java/com/wmods/wppenhacer/xposed/features/general/LiteMode.java +++ b/app/src/main/java/com/wmods/wppenhacer/xposed/features/general/LiteMode.java @@ -59,7 +59,7 @@ public void doHook() throws Throwable { menuItems.add(this::InsertDownloadFolderButton); - XposedHelpers.findAndHookMethod("com.whatsapp.HomeActivity", classLoader, "onCreate", Bundle.class, new XC_MethodHook() { + XposedHelpers.findAndHookMethod(WppCore.getHomeActivityClass(classLoader), "onCreate", Bundle.class, new XC_MethodHook() { @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { var activity = (Activity) param.thisObject; diff --git a/app/src/main/java/com/wmods/wppenhacer/xposed/features/general/NewChat.java b/app/src/main/java/com/wmods/wppenhacer/xposed/features/general/NewChat.java index ed0b6acf..e5555f00 100644 --- a/app/src/main/java/com/wmods/wppenhacer/xposed/features/general/NewChat.java +++ b/app/src/main/java/com/wmods/wppenhacer/xposed/features/general/NewChat.java @@ -15,6 +15,7 @@ import androidx.annotation.NonNull; import com.wmods.wppenhacer.xposed.core.Feature; +import com.wmods.wppenhacer.xposed.core.WppCore; import com.wmods.wppenhacer.xposed.core.components.AlertDialogWpp; import com.wmods.wppenhacer.xposed.utils.DesignUtils; import com.wmods.wppenhacer.xposed.utils.ResId; @@ -31,7 +32,7 @@ public NewChat(@NonNull ClassLoader loader, @NonNull XSharedPreferences preferen @Override public void doHook() { - var homeActivity = findClass("com.whatsapp.HomeActivity", classLoader); + var homeActivity = WppCore.getHomeActivityClass(classLoader); var action = prefs.getBoolean("buttonaction", true); if (!prefs.getBoolean("newchat", true)) return; diff --git a/app/src/main/java/com/wmods/wppenhacer/xposed/features/general/Others.java b/app/src/main/java/com/wmods/wppenhacer/xposed/features/general/Others.java index d0301a7d..81eda505 100644 --- a/app/src/main/java/com/wmods/wppenhacer/xposed/features/general/Others.java +++ b/app/src/main/java/com/wmods/wppenhacer/xposed/features/general/Others.java @@ -496,7 +496,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable { } private void hookMenuOptions(String filterChats) { - XposedHelpers.findAndHookMethod("com.whatsapp.HomeActivity", classLoader, "onPrepareOptionsMenu", Menu.class, new XC_MethodHook() { + XposedHelpers.findAndHookMethod(WppCore.getHomeActivityClass(classLoader), "onPrepareOptionsMenu", Menu.class, new XC_MethodHook() { @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { var menu = (Menu) param.args[0]; diff --git a/app/src/main/java/com/wmods/wppenhacer/xposed/features/others/Channels.java b/app/src/main/java/com/wmods/wppenhacer/xposed/features/others/Channels.java index 0f6ea64c..9c564b00 100644 --- a/app/src/main/java/com/wmods/wppenhacer/xposed/features/others/Channels.java +++ b/app/src/main/java/com/wmods/wppenhacer/xposed/features/others/Channels.java @@ -5,6 +5,7 @@ import androidx.annotation.NonNull; import com.wmods.wppenhacer.xposed.core.Feature; +import com.wmods.wppenhacer.xposed.core.WppCore; import com.wmods.wppenhacer.xposed.core.devkit.Unobfuscator; import com.wmods.wppenhacer.xposed.utils.ReflectionUtils; import com.wmods.wppenhacer.xposed.utils.Utils; @@ -74,7 +75,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable { }); if (channels) { - XposedHelpers.findAndHookMethod("com.whatsapp.HomeActivity", classLoader, "onPrepareOptionsMenu", Menu.class, new XC_MethodHook() { + XposedHelpers.findAndHookMethod(WppCore.getHomeActivityClass(classLoader), "onPrepareOptionsMenu", Menu.class, new XC_MethodHook() { @Override protected void beforeHookedMethod(MethodHookParam param) throws Throwable { var menu = (Menu) param.args[0]; diff --git a/app/src/main/java/com/wmods/wppenhacer/xposed/features/others/MenuHome.java b/app/src/main/java/com/wmods/wppenhacer/xposed/features/others/MenuHome.java index 7c07064b..255eb2dc 100644 --- a/app/src/main/java/com/wmods/wppenhacer/xposed/features/others/MenuHome.java +++ b/app/src/main/java/com/wmods/wppenhacer/xposed/features/others/MenuHome.java @@ -195,7 +195,7 @@ private void InsertFreezeLastSeenOption(Menu menu, Activity activity, boolean ne } private void hookMenu() { - XposedHelpers.findAndHookMethod("com.whatsapp.HomeActivity", classLoader, "onCreateOptionsMenu", Menu.class, new XC_MethodHook() { + XposedHelpers.findAndHookMethod(WppCore.getHomeActivityClass(classLoader), "onCreateOptionsMenu", Menu.class, new XC_MethodHook() { @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { var menu = (Menu) param.args[0]; diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 4f757d64..64892da5 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -124,6 +124,7 @@ 2.25.3.xx 2.25.4.xx 2.25.5.xx + 2.25.6.xx 2.25.1.xx @@ -131,6 +132,7 @@ 2.25.3.xx 2.25.4.xx 2.25.5.xx + 2.25.6.xx image/*