Skip to content

Commit

Permalink
fix: ShowHideEmo for QQNT
Browse files Browse the repository at this point in the history
  • Loading branch information
klxiaoniu committed Sep 12, 2023
1 parent 6cd0ff7 commit 377efd4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/src/main/java/cc/hicore/hook/ShowHideEmo.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
package cc.hicore.hook;

import androidx.annotation.NonNull;
import cc.hicore.QApp.QAppUtils;
import cc.ioctl.util.HookUtils;
import cc.ioctl.util.HostInfo;
import io.github.qauxv.base.annotation.FunctionHookEntry;
Expand All @@ -31,7 +32,12 @@
import io.github.qauxv.util.Initiator;
import io.github.qauxv.util.IoUtils;
import io.github.qauxv.util.Log;
import io.github.qauxv.util.dexkit.DexKit;
import io.github.qauxv.util.dexkit.DexKitTarget;
import io.github.qauxv.util.dexkit.NT_SysAndEmojiResInfo;
import java.io.File;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.nio.charset.StandardCharsets;
import org.json.JSONArray;
import org.json.JSONObject;
Expand All @@ -43,6 +49,7 @@ public class ShowHideEmo extends CommonSwitchFunctionHook {
public static final ShowHideEmo INSTANCE = new ShowHideEmo();

private ShowHideEmo() {
super(new DexKitTarget[]{NT_SysAndEmojiResInfo.INSTANCE});
}

@NonNull
Expand All @@ -59,6 +66,16 @@ public String[] getUiItemLocation() {

@Override
protected boolean initOnce() throws Exception {
if (QAppUtils.isQQnt()) {
Method[] ms = DexKit.requireClassFromCache(NT_SysAndEmojiResInfo.INSTANCE).getDeclaredMethods();
for (Method m : ms) {
if (m.getReturnType() == boolean.class && !Modifier.isAbstract(m.getModifiers())) {
HookUtils.hookBeforeIfEnabled(this, m, param -> param.setResult(false));
return true;
}
}
return false;
}
HookUtils.hookBeforeIfEnabled(this,
Initiator.loadClass("com.tencent.mobileqq.emoticon.QQSysAndEmojiResInfo")
.getDeclaredMethod("isEmoticonHide", Initiator.loadClass("com.tencent.mobileqq.emoticon.QQSysAndEmojiResInfo$QQEmoConfigItem")),
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/io/github/qauxv/util/dexkit/DexKitTarget.kt
Original file line number Diff line number Diff line change
Expand Up @@ -804,3 +804,10 @@ data object AIODelegate_ISwipeListener : DexKitTarget.UsingStringVector() {
override val traitStringVectors = arrayOf(arrayOf("aio_disappear_type", "close_aio"))
override val filter = DexKitFilter.strInClsName("com/tencent/qqnt/aio/activity")
}

data object NT_SysAndEmojiResInfo : DexKitTarget.UsingStringVector() {
override val findMethod: Boolean = false
override val traitStringVectors = arrayOf(arrayOf("NT_SysAndEmojiResInfo", "reloadDrawable restartDownload:"))
override val declaringClass = ""
override val filter = DexKitFilter.allowAll
}

0 comments on commit 377efd4

Please sign in to comment.