Fix for mdgram

This commit is contained in:
DarkCat09 2023-04-13 11:36:06 +04:00
parent 1a5d8e9b7c
commit bf95bd7f63
2 changed files with 22 additions and 2 deletions

View file

@ -5,6 +5,7 @@ import java.util.List;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodReplacement;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
@ -63,5 +64,24 @@ public class MainHook implements IXposedHookLoadPackage {
}
} catch (Throwable ignored) { }
}
if (lpparam.packageName.equals("org.telegram.mdgram")) {
try {
Class<?> getSponsoredMessagesClass = XposedHelpers.findClassIfExists("org.telegram.tgnet.TLRPC$TL_channels_getSponsoredMessages", lpparam.classLoader);
if (getSponsoredMessagesClass != null) {
XposedBridge.hookAllMethods(getSponsoredMessagesClass, "a", XC_MethodReplacement.returnConstant(null));
}
Class<?> messageClass = XposedHelpers.findClassIfExists("org.telegram.tgnet.TLRPC$Message", lpparam.classLoader);
if (messageClass != null) {
XposedBridge.hookAllConstructors(messageClass, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
XposedHelpers.setBooleanField(param.thisObject, "noforwards", false);
}
});
}
} catch (Throwable ignored) { }
}
}
}

View file

@ -12,11 +12,11 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
appVerName=23.04.12
appVerCode=202304120
appVerCode=202304122