package com.shatyuka.killergram; import java.util.Arrays; import java.util.List; 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 List hookPackages = Arrays.asList( "org.telegram.messenger", "org.telegram.messenger.web", "org.telegram.messenger.beta", "nekox.messenger", "tw.nekomimi.nekogram", "org.telegram.plus", "com.iMe.android", "org.telegram.BifToGram"); @Override public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) { if (hookPackages.contains(lpparam.packageName)) { try { Class chatUIActivityClass = XposedHelpers.findClass("org.telegram.ui.ChatActivity", lpparam.classLoader); XposedBridge.hookAllMethods(chatUIActivityClass, "addSponsoredMessages", XC_MethodReplacement.returnConstant(null)); } catch (Throwable ignored) { } } } }