Add more clients support

This commit is contained in:
Shatyuka 2021-11-10 14:47:40 +08:00
parent 8a06e6c411
commit 05f2bf3055
5 changed files with 24 additions and 7 deletions

1
.gitignore vendored
View file

@ -2,7 +2,6 @@
.gradle
/local.properties
/.idea
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures

2
app/.gitignore vendored
View file

@ -1 +1,3 @@
/build
/release
/debug

View file

@ -7,7 +7,7 @@ android {
defaultConfig {
applicationId "com.shatyuka.killergram"
minSdk 23
minSdk 16
targetSdk 31
versionCode 1
versionName "1.0"

View file

@ -1,5 +1,8 @@
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;
@ -7,12 +10,21 @@ import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
public class MainHook implements IXposedHookLoadPackage {
public final static List<String> hookPackages = Arrays.asList(
"org.telegram.messenger",
"org.telegram.messenger.web",
"nekox.messenger",
"tw.nekomimi.nekogram",
"org.telegram.plus");
@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) {
}
}
}
}

View file

@ -2,5 +2,9 @@
<resources>
<string-array name="xposedscope">
<item>org.telegram.messenger</item>
<item>org.telegram.messenger.web</item>
<item>nekox.messenger</item>
<item>tw.nekomimi.nekogram</item>
<item>org.telegram.plus</item>
</string-array>
</resources>