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 .gradle
/local.properties /local.properties
/.idea /.idea
/.idea/assetWizardSettings.xml
.DS_Store .DS_Store
/build /build
/captures /captures

2
app/.gitignore vendored
View file

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

View file

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

View file

@ -1,5 +1,8 @@
package com.shatyuka.killergram; package com.shatyuka.killergram;
import java.util.Arrays;
import java.util.List;
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.XposedBridge;
@ -7,8 +10,16 @@ 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 List<String> hookPackages = Arrays.asList(
"org.telegram.messenger",
"org.telegram.messenger.web",
"nekox.messenger",
"tw.nekomimi.nekogram",
"org.telegram.plus");
@Override @Override
public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) { public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) {
if (hookPackages.contains(lpparam.packageName)) {
try { try {
Class<?> chatUIActivityClass = XposedHelpers.findClass("org.telegram.ui.ChatActivity", lpparam.classLoader); Class<?> chatUIActivityClass = XposedHelpers.findClass("org.telegram.ui.ChatActivity", lpparam.classLoader);
XposedBridge.hookAllMethods(chatUIActivityClass, "addSponsoredMessages", XC_MethodReplacement.returnConstant(null)); XposedBridge.hookAllMethods(chatUIActivityClass, "addSponsoredMessages", XC_MethodReplacement.returnConstant(null));
@ -16,3 +27,4 @@ public class MainHook implements IXposedHookLoadPackage {
} }
} }
} }
}

View file

@ -2,5 +2,9 @@
<resources> <resources>
<string-array name="xposedscope"> <string-array name="xposedscope">
<item>org.telegram.messenger</item> <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> </string-array>
</resources> </resources>