Hook for mdgram applied to all packages

This commit is contained in:
DarkCat09 2023-04-13 11:36:38 +04:00
parent bf95bd7f63
commit fa8f441d66

View file

@ -62,25 +62,11 @@ public class MainHook implements IXposedHookLoadPackage {
XposedBridge.hookAllMethods(UserConfigClass, "getMaxAccountCount", XC_MethodReplacement.returnConstant(999));
XposedBridge.hookAllMethods(UserConfigClass, "hasPremiumOnAccounts", XC_MethodReplacement.returnConstant(true));
}
} 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) { }
}
}