Skip to content

Commit

Permalink
chore: limit some functions' max version
Browse files Browse the repository at this point in the history
  • Loading branch information
klxiaoniu committed Jun 20, 2023
1 parent 2d65fa7 commit af94fd8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
6 changes: 6 additions & 0 deletions app/src/main/java/cc/ioctl/hook/chat/SendGiftHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import android.app.Activity;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import cc.hicore.QApp.QAppUtils;
import cc.ioctl.util.HookUtils;
import cc.ioctl.util.HostInfo;
import cc.ioctl.util.Reflex;
Expand Down Expand Up @@ -57,6 +58,11 @@ public String getDescription() {
return "禁止聊天时输入$自动弹出[选择赠送对象]窗口";
}

@Override
public boolean isAvailable() {
return !QAppUtils.isQQnt();
}

@NonNull
@Override
public String[] getUiItemLocation() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import android.content.Context
import android.text.Spanned
import android.text.style.ForegroundColorSpan
import androidx.core.text.buildSpannedString
import cc.hicore.QApp.QAppUtils
import cc.ioctl.util.hookBeforeIfEnabled
import io.github.qauxv.base.annotation.FunctionHookEntry
import io.github.qauxv.base.annotation.UiItemAgentEntry
Expand All @@ -50,7 +51,7 @@ object HideGuildNewFeedHighLightText : CommonSwitchFunctionHook() {

override val uiItemLocation: Array<String> = FunctionEntryRouter.Locations.Simplify.MAIN_UI_MSG_LIST

override val isAvailable: Boolean get() = requireMinQQVersion(QQVersion.QQ_8_9_23)
override val isAvailable: Boolean get() = requireMinQQVersion(QQVersion.QQ_8_9_23) && !QAppUtils.isQQnt()

override fun initOnce(): Boolean {
// com.tencent.troopguild.api.impl.TroopGuildApiImpl->getHighLightStringByOptType(Context, int)String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@
import android.widget.EditText;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import cc.hicore.QApp.QAppUtils;
import cc.ioctl.util.HookUtils;
import io.github.qauxv.util.SyncUtils;
import io.github.qauxv.base.annotation.FunctionHookEntry;
import io.github.qauxv.base.annotation.UiItemAgentEntry;
import io.github.qauxv.dsl.FunctionEntryRouter.Locations.Auxiliary;
import io.github.qauxv.hook.CommonSwitchFunctionHook;
import io.github.qauxv.ui.ResUtils;
import io.github.qauxv.util.Initiator;
import io.github.qauxv.util.SyncUtils;
import java.lang.reflect.Field;
import java.lang.reflect.Method;

Expand All @@ -59,6 +60,11 @@ public String getDescription() {
return "修复夜间模式下群申请拒绝消息中的拒绝原因看不清的问题";
}

@Override
public boolean isAvailable() {
return !QAppUtils.isQQnt();
}

@NonNull
@Override
public String[] getUiItemLocation() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package com.xiaoniu.hook

import cc.hicore.QApp.QAppUtils
import cc.ioctl.util.hookBeforeIfEnabled
import io.github.qauxv.base.annotation.FunctionHookEntry
import io.github.qauxv.base.annotation.UiItemAgentEntry
Expand All @@ -43,10 +44,9 @@ object DisableAddTroopToRecentUser : CommonSwitchFunctionHook(arrayOf(TroopGuild

override val uiItemLocation: Array<String> = FunctionEntryRouter.Locations.Simplify.MAIN_UI_MSG_LIST

override val isAvailable: Boolean get() = requireMinQQVersion(QQVersion.QQ_8_9_23)
override val isAvailable: Boolean get() = requireMinQQVersion(QQVersion.QQ_8_9_23) && !QAppUtils.isQQnt()

override fun initOnce(): Boolean {
if (!requireMinQQVersion(QQVersion.QQ_8_9_23)) return false
// Lcom/tencent/troopguild/api/impl/TroopGuildRecentServiceImpl;->addTroopToRecentUser(Ljava/lang/String;)V
val kTroopGuildRecentServiceImpl = Initiator.loadClass("com.tencent.troopguild.api.impl.TroopGuildRecentServiceImpl")
val addTroopToRecentUser = kTroopGuildRecentServiceImpl.getDeclaredMethod("addTroopToRecentUser", String::class.java)
Expand Down

0 comments on commit af94fd8

Please sign in to comment.