Skip to content

Commit

Permalink
fix: optimize OneTapTwentyLikes
Browse files Browse the repository at this point in the history
  • Loading branch information
klxiaoniu committed Nov 10, 2023
1 parent c99b66e commit d2244a8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions app/src/main/java/cc/ioctl/hook/profile/OneTapTwentyLikes.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,30 +66,32 @@ public boolean isAvailable() {

@Override
public boolean initOnce() throws ReflectiveOperationException {
Class<?> CardProfile = Initiator.loadClass("com.tencent.mobileqq.data.CardProfile");
Method onClickVote = Reflex.findSingleMethod(Initiator._VoteHelper(), null, false,
Initiator.loadClass("com.tencent.mobileqq.data.CardProfile"), ImageView.class);
CardProfile, ImageView.class);
for (Method m : Initiator.loadClass("com.tencent.mobileqq.activity.VisitorsActivity").getDeclaredMethods()) {
if (m.getName().equals("onClick")) {
HookUtils.hookBeforeIfEnabled(this, m, param -> {
View view = (View) param.args[0];
Object profile = view.getTag();
if (profile == null || !CardProfile.isInstance(profile)) return;
Object voteHelper = getFirstByType(param.thisObject, Initiator._VoteHelper());
for (int i = 0; i < 20; i++) {
onClickVote.invoke(voteHelper, profile, (ImageView) view);
onClickVote.invoke(voteHelper, profile, view);
}
});
}
}

Method onClickOnProfileCard = Reflex.findMethod(Initiator.loadClass("com.tencent.mobileqq.profilecard.base.component.AbsProfileHeaderComponent"), "handleVoteBtnClickForGuestProfile",
Method onClickOnProfileCard = Reflex.findMethod(Initiator.loadClass("com.tencent.mobileqq.profilecard.base.component.AbsProfileHeaderComponent"),
"handleVoteBtnClickForGuestProfile",
Initiator.loadClass("com.tencent.mobileqq.data.Card"));
HookUtils.hookBeforeIfEnabled(this,onClickOnProfileCard,param -> {
HookUtils.hookBeforeIfEnabled(this, onClickOnProfileCard, param -> {
for (int i = 0; i < 19; i++) {
XposedBridge.invokeOriginalMethod(param.method,param.thisObject,param.args);
XposedBridge.invokeOriginalMethod(param.method, param.thisObject, param.args);
}
});


return true;
}
}

0 comments on commit d2244a8

Please sign in to comment.