Add ability to enable for all Telegram clients
This commit is contained in:
parent
ddbdf96cf6
commit
abb5b232db
2 changed files with 6 additions and 4 deletions
|
@ -2,16 +2,18 @@ package com.shatyuka.killergram;
|
||||||
|
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage;
|
import de.robv.android.xposed.IXposedHookLoadPackage;
|
||||||
import de.robv.android.xposed.XC_MethodReplacement;
|
import de.robv.android.xposed.XC_MethodReplacement;
|
||||||
|
import de.robv.android.xposed.XposedBridge;
|
||||||
import de.robv.android.xposed.XposedHelpers;
|
import de.robv.android.xposed.XposedHelpers;
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage;
|
import de.robv.android.xposed.callbacks.XC_LoadPackage;
|
||||||
|
|
||||||
public class MainHook implements IXposedHookLoadPackage {
|
public class MainHook implements IXposedHookLoadPackage {
|
||||||
public final static String hookPackage = "org.telegram.messenger";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) {
|
public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) {
|
||||||
if (hookPackage.equals(lpparam.packageName)) {
|
try {
|
||||||
XposedHelpers.findAndHookMethod("org.telegram.ui.ChatActivity", lpparam.classLoader, "addSponsoredMessages", boolean.class, XC_MethodReplacement.returnConstant(null));
|
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
0
gradlew
vendored
Normal file → Executable file
Loading…
Add table
Reference in a new issue