Skip to content

Commit

Permalink
fix: createItemNt failure
Browse files Browse the repository at this point in the history
  • Loading branch information
klxiaoniu committed Jul 11, 2023
1 parent 7b19515 commit d60a528
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
6 changes: 4 additions & 2 deletions app/src/main/java/cc/hicore/hook/RepeaterPlus.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
import io.github.qauxv.util.Initiator;
import io.github.qauxv.util.Log;
import io.github.qauxv.util.QQVersion;
import io.github.qauxv.util.dexkit.AbstractQQCustomMenuItem;
import io.github.qauxv.util.dexkit.DexKitTarget;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -86,7 +88,7 @@ public class RepeaterPlus extends BaseFunctionHook implements SessionHooker.IAIO
public static final RepeaterPlus INSTANCE = new RepeaterPlus();

private RepeaterPlus() {
super();
super(null, false, new DexKitTarget[]{AbstractQQCustomMenuItem.INSTANCE});
}

private IUiItemAgent mUiAgent = null;
Expand Down Expand Up @@ -260,7 +262,7 @@ protected void afterHookedMethod(MethodHookParam param) {
});
List list = (List) param.getResult();
List result = new ArrayList<>();
result.add(0,item);
result.add(0, item);
result.addAll(list);
param.setResult(result);
});
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/cc/ioctl/hook/msg/CopyCardMsg.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import io.github.qauxv.util.CustomMenu.createItemNt
import io.github.qauxv.util.Initiator
import io.github.qauxv.util.QQVersion
import io.github.qauxv.util.Toasts
import io.github.qauxv.util.dexkit.AbstractQQCustomMenuItem
import io.github.qauxv.util.dexkit.CArkAppItemBubbleBuilder
import io.github.qauxv.util.dexkit.DexKit
import io.github.qauxv.util.requireMinQQVersion
Expand All @@ -53,7 +54,7 @@ import java.lang.reflect.Method

@FunctionHookEntry
@UiItemAgentEntry
object CopyCardMsg : CommonSwitchFunctionHook("CopyCardMsg::BaseChatPie", arrayOf(CArkAppItemBubbleBuilder)) {
object CopyCardMsg : CommonSwitchFunctionHook("CopyCardMsg::BaseChatPie", arrayOf(CArkAppItemBubbleBuilder, AbstractQQCustomMenuItem)) {

override val name = "复制卡片消息"

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/cc/ioctl/hook/msg/PicMd5Hook.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
import io.github.qauxv.util.LicenseStatus;
import io.github.qauxv.util.QQVersion;
import io.github.qauxv.util.Toasts;
import io.github.qauxv.util.dexkit.AbstractQQCustomMenuItem;
import io.github.qauxv.util.dexkit.DexKitTarget;
import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.util.List;
Expand All @@ -60,6 +62,7 @@ public class PicMd5Hook extends CommonSwitchFunctionHook {
public static final PicMd5Hook INSTANCE = new PicMd5Hook();

private PicMd5Hook() {
super(new DexKitTarget[]{AbstractQQCustomMenuItem.INSTANCE});
}

@NonNull
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/cc/ioctl/hook/msg/PttForwardHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
import io.github.qauxv.util.SyncUtils;
import io.github.qauxv.util.Toasts;
import io.github.qauxv.util.data.ContactDescriptor;
import io.github.qauxv.util.dexkit.AbstractQQCustomMenuItem;
import io.github.qauxv.util.dexkit.CDialogUtil;
import io.github.qauxv.util.dexkit.CFaceDe;
import io.github.qauxv.util.dexkit.DexKitTarget;
Expand Down Expand Up @@ -122,7 +123,7 @@ public String[] getUiItemLocation() {
}

private PttForwardHook() {
super(SyncUtils.PROC_MAIN, new DexKitTarget[]{CFaceDe.INSTANCE, CDialogUtil.INSTANCE});
super(SyncUtils.PROC_MAIN, new DexKitTarget[]{CFaceDe.INSTANCE, CDialogUtil.INSTANCE, AbstractQQCustomMenuItem.INSTANCE});
}

private static void showSavePttFileDialog(Activity activity, final File ptt) {
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/java/io/github/qauxv/util/CustomMenu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,13 @@ object CustomMenu {
)
}

/**
* Remember to add DexKitTarget AbstractQQCustomMenuItem to the constructor!
*/
@JvmStatic
fun createItemNt(msg: Any, text: String, id: Int, click: () -> Unit): Any {
val msgClass = Initiator.loadClass("com.tencent.mobileqq.aio.msg.AIOMsgItem")
val absMenuItem = DexKit.loadClassFromCache(AbstractQQCustomMenuItem)!!
val absMenuItem = DexKit.requireClassFromCache(AbstractQQCustomMenuItem)
val clickName = absMenuItem.findMethod {
returnType == Void.TYPE && parameterTypes.isEmpty()
}.name
Expand Down

0 comments on commit d60a528

Please sign in to comment.