Fix Nekogram X
This commit is contained in:
parent
37690d8f3f
commit
74ab6ae411
2 changed files with 12 additions and 4 deletions
|
@ -1,6 +1,8 @@
|
||||||
# Killergram
|
# Killergram
|
||||||
|
|
||||||
An Android Xposed module to remove sponsored messages of Telegram
|
An Android Xposed module to remove sponsored messages of Telegram.
|
||||||
|
|
||||||
|
Also allows you to copy or save messages when "Restrict saving content" is enabled. Forwarding messages is still not working due to server limitation.
|
||||||
|
|
||||||
### Support clients
|
### Support clients
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,15 @@ public class MainHook implements IXposedHookLoadPackage {
|
||||||
public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) {
|
public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) {
|
||||||
if (hookPackages.contains(lpparam.packageName)) {
|
if (hookPackages.contains(lpparam.packageName)) {
|
||||||
try {
|
try {
|
||||||
Class<?> messagesControllerClass = XposedHelpers.findClass("org.telegram.messenger.MessagesController", lpparam.classLoader);
|
Class<?> messagesControllerClass = XposedHelpers.findClassIfExists("org.telegram.messenger.MessagesController", lpparam.classLoader);
|
||||||
XposedBridge.hookAllMethods(messagesControllerClass, "getSponsoredMessages", XC_MethodReplacement.returnConstant(null));
|
if (messagesControllerClass != null) {
|
||||||
XposedBridge.hookAllMethods(messagesControllerClass, "isChatNoForwards", XC_MethodReplacement.returnConstant(false));
|
XposedBridge.hookAllMethods(messagesControllerClass, "getSponsoredMessages", XC_MethodReplacement.returnConstant(null));
|
||||||
|
XposedBridge.hookAllMethods(messagesControllerClass, "isChatNoForwards", XC_MethodReplacement.returnConstant(false));
|
||||||
|
}
|
||||||
|
Class<?> chatUIActivityClass = XposedHelpers.findClassIfExists("org.telegram.ui.ChatActivity", lpparam.classLoader);
|
||||||
|
if (chatUIActivityClass != null) {
|
||||||
|
XposedBridge.hookAllMethods(chatUIActivityClass, "addSponsoredMessages", XC_MethodReplacement.returnConstant(null));
|
||||||
|
}
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue