Skip to content

Commit

Permalink
fix bug in channels
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev4Mod committed Jun 25, 2024
1 parent 8d47e3d commit bb07619
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1584,26 +1584,50 @@ public static Method loadPlaybackSpeed(ClassLoader classLoader) throws Exception
});
}

public static Method loadArchiveCheckLockedChatsMethod(ClassLoader classLoader) throws Exception {
var method = findFirstMethodUsingStrings(classLoader, StringMatchType.Contains, "conversationsfragment/verticalswipetorevealbehavior");
if (method == null) throw new RuntimeException("ArchiveCheckLockedChats method not found");
return method;
}
// public static Method loadArchiveCheckLockedChatsMethod(ClassLoader classLoader) throws Exception {
// var method = findFirstMethodUsingStrings(classLoader, StringMatchType.Contains, "conversationsfragment/verticalswipetorevealbehavior");
// if (method == null) throw new RuntimeException("ArchiveCheckLockedChats method not found");
// return method;
// }
//
// public static Method loadArchiveCheckLockedChatsMethod2(ClassLoader classLoader) throws Exception {
// var methods = findAllMethodUsingStrings(classLoader, StringMatchType.Contains, "registration_device_id");
// if (methods.length == 0)
// throw new RuntimeException("ArchiveCheckLockedChats method not found");
// return Arrays.stream(methods).filter(m -> m.getReturnType().equals(boolean.class) && m.getParameterTypes().length == 0).findFirst().orElse(null);
// }
//
// public static Class<?> loadArchiveLockedChatClass(ClassLoader classLoader) throws Exception {
// return UnobfuscatorCache.getInstance().getClass(classLoader, () -> {
// var clazzList = dexkit.findClass(new FindClass().matcher(new ClassMatcher().addMethod(new MethodMatcher().name("setLockedRowVisibility")).addMethod(new MethodMatcher().name("setEnableStateForChatLock"))));
// if (clazzList.isEmpty())
// throw new RuntimeException("ArchiveLockedChatFrame class not found");
// return clazzList.get(0).getInstance(classLoader);
// });
// }

public static Method loadArchiveCheckLockedChatsMethod2(ClassLoader classLoader) throws Exception {
var methods = findAllMethodUsingStrings(classLoader, StringMatchType.Contains, "registration_device_id");
if (methods.length == 0)
throw new RuntimeException("ArchiveCheckLockedChats method not found");
return Arrays.stream(methods).filter(m -> m.getReturnType().equals(boolean.class) && m.getParameterTypes().length == 0).findFirst().orElse(null);
public static Constructor loadListUpdateItemsConstructor(ClassLoader classLoader) throws Exception {
return UnobfuscatorCache.getInstance().getConstructor(classLoader, () -> {
var method = dexkit.findMethod(new FindMethod().matcher(new MethodMatcher().paramCount(1).returnType(void.class).addParamType(Object.class).addUsingNumber(8686)));
if (method.isEmpty())
throw new RuntimeException("ListUpdateItems method not found");
return method.get(0).getClassInstance(classLoader).getConstructors()[0];
});
}

public static Class<?> loadArchiveLockedChatClass(ClassLoader classLoader) throws Exception {
public static Class loadHeaderChannelItemClass(ClassLoader classLoader) throws Exception {
return UnobfuscatorCache.getInstance().getClass(classLoader, () -> {
var clazzList = dexkit.findClass(new FindClass().matcher(new ClassMatcher().addMethod(new MethodMatcher().name("setLockedRowVisibility")).addMethod(new MethodMatcher().name("setEnableStateForChatLock"))));
if (clazzList.isEmpty())
throw new RuntimeException("ArchiveLockedChatFrame class not found");
return clazzList.get(0).getInstance(classLoader);
var clazz = findFirstClassUsingStrings(classLoader, StringMatchType.Contains, "NewsletterHeaderDataItem");
if (clazz == null) throw new RuntimeException("HeaderChannelItem class not found");
return clazz;
});
}

public static Class loadListChannelItemClass(ClassLoader classLoader) throws Exception {
return UnobfuscatorCache.getInstance().getClass(classLoader, () -> {
var clazz = findFirstClassUsingStrings(classLoader, StringMatchType.Contains, "NewsletterDataItem", "isMuteIndicatorEnabled");
if (clazz == null) throw new RuntimeException("HeaderChannelItem class not found");
return clazz;
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ public CustomView(@NonNull ClassLoader loader, @NonNull XSharedPreferences prefe
@Override
public void doHook() throws Throwable {
var filter_itens = prefs.getString("css_theme", "");
var channels = prefs.getBoolean("channels", false);
if (channels) {
filter_itens = "#updates_list RelativeLayout,#updates_list ViewGroup:nth-child(4){display:none}\n" + filter_itens;
}
if (TextUtils.isEmpty(filter_itens)) return;
cacheImages = new DrawableCache(Utils.getApplication(), 100 * 1024 * 1024);
chacheDrawables = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import com.wmods.wppenhacer.xposed.core.Feature;
import com.wmods.wppenhacer.xposed.core.devkit.Unobfuscator;

import org.luckypray.dexkit.util.DexSignUtil;

import java.util.ArrayList;
import java.util.List;

import de.robv.android.xposed.XC_MethodHook;
Expand All @@ -20,6 +23,23 @@ public Channels(ClassLoader loader, XSharedPreferences preferences) {
public void doHook() throws Throwable {
var channels = prefs.getBoolean("channels", false);
var removechannelRec = prefs.getBoolean("removechannel_rec", false);
if (channels) {
var headerChannelItem = Unobfuscator.loadHeaderChannelItemClass(classLoader);
log("HeaderChannelItem: " + headerChannelItem);
var listChannelItem = Unobfuscator.loadListChannelItemClass(classLoader);
log("ListChannelItem: " + listChannelItem);
var listUpdateItems = Unobfuscator.loadListUpdateItemsConstructor(classLoader);
log("ListUpdateItems: " + DexSignUtil.getConstructorSign(listUpdateItems));
XposedBridge.hookMethod(listUpdateItems,
new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (param.args[0] instanceof ArrayList<?> list) {
list.removeIf((e) -> headerChannelItem.isInstance(e) || listChannelItem.isInstance(e));
}
}
});
}
if (removechannelRec || channels) {
var removeChannelRecClass = Unobfuscator.loadRemoveChannelRecClass(classLoader);
XposedBridge.hookAllConstructors(removeChannelRecClass, new XC_MethodHook() {
Expand Down
21 changes: 1 addition & 20 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
[FUNCTIONS]
* Enabled the option to show all statuses (Go to the updates tab and check the options menu), on this screen it is possible to filter and search for statuses by name, viewed, muted, and others
* Added the function to show the old UI statuses (NOTE: This causes interface lag when switching tabs by sliding), This function automatically deactivates the channels.

[CHANNELS]
* The option to deactivate channels was changed to hide channels and is now compatible with IG Status and maintains the current structure of statuses

[WALLPAPER ON HOMESCREEN]
* The way images are loaded was changed because if the image was too large it caused lag and now it will be resized and saved for quick use

[CUSTOM CSS]
* All images are resized to the size of the View and saved in cache to save RAM and avoid lags

[SEPARATE GROUPS]
* Fixed unread message count for blocked chats

[REMOVE LIMIT FORWARD]
* Fixed a bug in groups and added a note warning of ban for spam in cases of abuse, use with caution
* Fixed bug where statuses disappeared.

[WA ENHANCER]
* Added the option to force English
* Updated translations



0 comments on commit bb07619

Please sign in to comment.