diff --git a/app/src/main/java/cc/ioctl/hook/misc/AntiUpdate.kt b/app/src/main/java/cc/ioctl/hook/misc/AntiUpdate.kt index bb86c22737..6a47985d3a 100644 --- a/app/src/main/java/cc/ioctl/hook/misc/AntiUpdate.kt +++ b/app/src/main/java/cc/ioctl/hook/misc/AntiUpdate.kt @@ -35,8 +35,7 @@ import io.github.qauxv.hook.CommonSwitchFunctionHook import io.github.qauxv.util.Initiator import java.lang.reflect.Method -@FunctionHookEntry -@UiItemAgentEntry +// instead HookUpgrade object AntiUpdate : CommonSwitchFunctionHook() { override val name: String = "屏蔽更新" diff --git a/app/src/main/java/cc/ioctl/hook/qwallet/QWalletNoAD.kt b/app/src/main/java/cc/ioctl/hook/qwallet/QWalletNoAD.kt index fe12accf8f..78d47cee89 100644 --- a/app/src/main/java/cc/ioctl/hook/qwallet/QWalletNoAD.kt +++ b/app/src/main/java/cc/ioctl/hook/qwallet/QWalletNoAD.kt @@ -41,8 +41,8 @@ import xyz.nextalone.util.getIdentifier import xyz.nextalone.util.hookAfter import xyz.nextalone.util.throwOrTrue -@FunctionHookEntry -@UiItemAgentEntry +//@FunctionHookEntry +//@UiItemAgentEntry object QWalletNoAD : PluginDelayableHook("ketal_qwallet_noad") { override val preference = uiSwitchPreference { title = "隐藏QQ钱包超值精选" diff --git a/app/src/main/java/com/alphi/qhmk/module/DisableX5.java b/app/src/main/java/com/alphi/qhmk/module/DisableX5.java index 4384865d3e..c97f320195 100644 --- a/app/src/main/java/com/alphi/qhmk/module/DisableX5.java +++ b/app/src/main/java/com/alphi/qhmk/module/DisableX5.java @@ -27,7 +27,7 @@ private DisableX5() { @Override protected boolean initOnce() throws Exception { // NT - Class kQbSdk = Initiator.loadClass("com/tencent/smtt/sdk/QbSdk"); + Class kQbSdk = Initiator.load("com/tencent/smtt/sdk/QbSdk"); if (kQbSdk != null) { Method method = kQbSdk.getDeclaredMethod("getIsSysWebViewForcedByOuter"); HookUtils.hookBeforeIfEnabled(this, method, param -> { @@ -36,37 +36,42 @@ protected boolean initOnce() throws Exception { return true; } // older - Class tbsClass = Initiator.loadClass("com.tencent.smtt.sdk.WebView"); - Class TbsClassConfig = null; - for (Field field : tbsClass.getDeclaredFields()) { - Class type = field.getType(); - if (type.getName().contains("com.tencent.smtt.utils.")) { - TbsClassConfig = type; + Class tbsClass = Initiator.load("com.tencent.smtt.sdk.WebView"); + Class tbsClassConfig = null; + if (tbsClass != null) { + for (Field field : tbsClass.getDeclaredFields()) { + Class type = field.getType(); + Package tPackage = type.getPackage(); + if (tPackage != null && tPackage.getName().equals("com.tencent.smtt.utils")) { + tbsClassConfig = type; + } } } - if (TbsClassConfig == null) { - throw new IllegalStateException("X5Settings init fail!!!"); - } - Method method = ArraysKt.single(TbsClassConfig.getDeclaredMethods(), m -> m.getReturnType() == void.class); - HookUtils.hookAfterIfEnabled(this, method, param -> { - boolean result = false; - Log.d("hook:" + param.thisObject.getClass()); - for (Field field : param.thisObject.getClass().getFields()) { - if (field.getType() == boolean.class) { - try { - field.set(param.thisObject, true); - result = true; - } catch (IllegalAccessException e) { - traceError(e); + if (tbsClassConfig != null) { + Method method = ArraysKt.single(tbsClassConfig.getDeclaredMethods(), m -> m.getReturnType() == void.class); + HookUtils.hookAfterIfEnabled(this, method, param -> { + boolean result = false; + Log.d("hook:" + param.thisObject.getClass()); + for (Field field : param.thisObject.getClass().getFields()) { + if (field.getType() == boolean.class) { + try { + field.set(param.thisObject, true); + result = true; + } catch (IllegalAccessException e) { + traceError(e); + } } } - } - if (result) { - Log.d("ForceUseSystemWebView success!"); - } else { - Log.e("ForceUseSystemWebView fail!!!"); - } - }); + if (result) { + Log.d("old:ForceUseSystemWebView success!"); + } else { + Log.e("old:ForceUseSystemWebView fail!!!"); + } + }); + } + if (tbsClassConfig == null && kQbSdk == null) { + throw new IllegalStateException("X5Settings init fail!!! cause by not found class..."); + } return true; } diff --git a/app/src/main/java/com/alphi/qhmk/module/HookQWallet.java b/app/src/main/java/com/alphi/qhmk/module/HookQWallet.java index 77edd537c6..fd03025db5 100644 --- a/app/src/main/java/com/alphi/qhmk/module/HookQWallet.java +++ b/app/src/main/java/com/alphi/qhmk/module/HookQWallet.java @@ -6,7 +6,6 @@ import androidx.annotation.Nullable; import cc.ioctl.util.HookUtils; import de.robv.android.xposed.XC_MethodHook; -import de.robv.android.xposed.XC_MethodReplacement; import de.robv.android.xposed.XposedBridge; import io.github.qauxv.base.annotation.FunctionHookEntry; import io.github.qauxv.base.annotation.UiItemAgentEntry; @@ -32,12 +31,15 @@ protected boolean initOnce() throws Exception { // NT Class kQWalletHomeFragment = Initiator.load("com/tencent/mobileqq/qwallet/home/QWalletHomeFragment"); if (kQWalletHomeFragment != null) { - Class kQWalletHomePreviewController = Initiator.loadClass("com/tencent/mobileqq/qwallet/home/QWalletHomePreviewController"); - // public final QWalletHomePreviewController.?(QWallBaseFragment|QWalletBaseFragment)Z - Method method1 = ArraysKt.single(kQWalletHomePreviewController.getDeclaredMethods(), - it -> it.getReturnType() == boolean.class && it.getParameterTypes().length == 1 && - it.getParameterTypes()[0].getSimpleName().endsWith("BaseFragment")); - HookUtils.hookBeforeIfEnabled(this, method1, param -> param.setResult(true)); + Class kQWalletHomePreviewController = Initiator.load("com/tencent/mobileqq/qwallet/home/QWalletHomePreviewController"); + if (kQWalletHomePreviewController != null) { + // 预防广告视图显示导致的黑屏 + // public final QWalletHomePreviewController.?(QWallBaseFragment|QWalletBaseFragment)Z + Method methodIsShowAdView = ArraysKt.single(kQWalletHomePreviewController.getDeclaredMethods(), + it -> it.getReturnType() == boolean.class && it.getParameterTypes().length == 1 && + it.getParameterTypes()[0].getSimpleName().endsWith("BaseFragment")); + HookUtils.hookBeforeIfEnabled(this, methodIsShowAdView, param -> param.setResult(true)); + } Method onViewCreated = kQWalletHomeFragment.getDeclaredMethod("onViewCreated", View.class, Bundle.class); HookUtils.hookBeforeIfEnabled(this, onViewCreated, param -> { // 加载广告及视图初始化 @@ -48,9 +50,13 @@ protected boolean initOnce() throws Exception { Class aClass = Initiator.load("Lcom/tencent/mobileqq/qwallet/config/impl/QWalletConfigServiceImpl;"); if (aClass != null) { for (Method method : aClass.getDeclaredMethods()) { - XposedBridge.hookMethod(method, new XC_MethodReplacement() { + HookUtils.hookBeforeIfEnabled(this, method, new HookUtils.BeforeHookedMethod() { @Override - protected Object replaceHookedMethod(XC_MethodHook.MethodHookParam param) { + public void beforeHookedMethod(XC_MethodHook.MethodHookParam param) { + param.setResult(resultObj()); + } + + private Object resultObj() { if (method.getReturnType() == boolean.class) { return false; } @@ -76,13 +82,13 @@ protected Object replaceHookedMethod(XC_MethodHook.MethodHookParam param) { @NonNull @Override public String getName() { - return "去除QQ钱包广告"; + return "隐藏QQ钱包超值精选"; } @Nullable @Override public CharSequence getDescription() { - return "省流量方案需重启 致敬QHMK"; + return "致敬 QHMK"; } @Override @@ -93,7 +99,7 @@ public boolean isApplicationRestartRequired() { @NonNull @Override public String[] getUiItemLocation() { - return FunctionEntryRouter.Locations.Simplify.UI_MISC; + return FunctionEntryRouter.Locations.Simplify.SLIDING_UI; } } diff --git a/app/src/main/java/com/alphi/qhmk/module/HookUpgrade.java b/app/src/main/java/com/alphi/qhmk/module/HookUpgrade.java new file mode 100644 index 0000000000..d71c270192 --- /dev/null +++ b/app/src/main/java/com/alphi/qhmk/module/HookUpgrade.java @@ -0,0 +1,71 @@ +package com.alphi.qhmk.module; + + +import androidx.annotation.NonNull; +import cc.ioctl.util.HookUtils; +import io.github.qauxv.base.annotation.FunctionHookEntry; +import io.github.qauxv.base.annotation.UiItemAgentEntry; +import io.github.qauxv.dsl.FunctionEntryRouter; +import io.github.qauxv.hook.CommonSwitchFunctionHook; +import io.github.qauxv.util.Initiator; +import io.github.qauxv.util.SyncUtils; +import java.lang.reflect.Method; + +/** + * IDEA 2022/1/9 + */ + +@UiItemAgentEntry +@FunctionHookEntry +public class HookUpgrade extends CommonSwitchFunctionHook { + + private HookUpgrade() { + super(SyncUtils.PROC_MAIN | SyncUtils.PROC_TOOL); + } + + @NonNull + @Override + public String[] getUiItemLocation() { + return FunctionEntryRouter.Locations.Simplify.UI_MISC; + } + + @Override + protected boolean initOnce() throws Exception { + try { + Class configHandlerClass = Initiator.loadClass("com.tencent.mobileqq.app.ConfigHandler"); + for (Method m: configHandlerClass.getDeclaredMethods()){ + Class[] parameterTypes = m.getParameterTypes(); + if (m.getReturnType() == void.class && parameterTypes.length == 1 && parameterTypes[0].getSimpleName().equals("UpgradeDetailWrapper")){ + HookUtils.hookBeforeIfEnabled(this, m, param -> param.setResult(null)); + } + } + + Class upgc; + upgc = Initiator.load("com.tencent.mobileqq.upgrade.UpgradeController"); + if (upgc == null) { + upgc = Initiator.load("com.tencent.mobileqq.app.upgrade.UpgradeController"); + } + if (upgc == null){ + throw new RuntimeException("HookUpgrade: 加载出错"); + } + + for (Method m : upgc.getDeclaredMethods()) { + if (m.getReturnType() == void.class) { + HookUtils.hookBeforeIfEnabled(this, m, param -> param.setResult(null)); + } else if (m.getReturnType() == boolean.class) { + HookUtils.hookBeforeIfEnabled(this, m, param -> param.setResult(false)); + } + } + + } catch (Exception e) { + throw new RuntimeException("HookUpgrade: 加载出错"); + } + return false; + } + + @NonNull + @Override + public String getName() { + return "屏蔽更新"; + } +} diff --git a/app/src/main/java/xyz/nextalone/hook/CleanRecentChat.kt b/app/src/main/java/xyz/nextalone/hook/CleanRecentChat.kt index eec02e5401..295d9c1b10 100644 --- a/app/src/main/java/xyz/nextalone/hook/CleanRecentChat.kt +++ b/app/src/main/java/xyz/nextalone/hook/CleanRecentChat.kt @@ -102,6 +102,18 @@ object CleanRecentChat : CommonSwitchFunctionHook(arrayOf(NFriendsStatusUtil_isC } } + private fun ntVersion() { + /* + contactType Equal: + == 1 联系人 + == 103 公众号 + == 2 群聊 + == 131 我的关联QQ账号 uid=9992 + class: com.tencent.qqnt.chats.core.adapter.holder.deleteMsg extend View.OnClickListener + */ + + } + private fun handler(recentAdapter: Any?, app: Any?, all: Boolean, other: Boolean, includeTopped: Boolean, context: Context) { try {