Add ability to enable for all Telegram clients

This commit is contained in:
frknkrc44 2021-11-10 04:24:59 +03:00
parent ddbdf96cf6
commit abb5b232db
2 changed files with 6 additions and 4 deletions

View file

@ -2,16 +2,18 @@ package com.shatyuka.killergram;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodReplacement;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
public class MainHook implements IXposedHookLoadPackage {
public final static String hookPackage = "org.telegram.messenger";
@Override
public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) {
if (hookPackage.equals(lpparam.packageName)) {
XposedHelpers.findAndHookMethod("org.telegram.ui.ChatActivity", lpparam.classLoader, "addSponsoredMessages", boolean.class, XC_MethodReplacement.returnConstant(null));
try {
Class<?> chatUIActivityClass = XposedHelpers.findClass("org.telegram.ui.ChatActivity", lpparam.classLoader);
XposedBridge.hookAllMethods(chatUIActivityClass, "addSponsoredMessages", XC_MethodReplacement.returnConstant(null));
} catch (Throwable throwable) {
XposedBridge.log("Hook failed for " + lpparam.packageName);
}
}
}

0
gradlew vendored Normal file → Executable file
View file