-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad38c72
commit 8f1a46c
Showing
11 changed files
with
140 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
app/src/main/java/moe/qwq/miko/internals/hooks/OneClickLike.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package moe.qwq.miko.internals.hooks | ||
|
||
import android.content.Context | ||
import android.view.View | ||
import com.tencent.mobileqq.activity.VisitorsActivity | ||
import com.tencent.mobileqq.data.CardProfile | ||
import com.tencent.mobileqq.profile.vote.VoteHelper | ||
import com.tencent.mobileqq.profilecard.base.component.AbsProfileHeaderComponent | ||
import de.robv.android.xposed.XposedBridge | ||
import moe.fuqiuluo.entries.MethodEnum.VoteHelperVote | ||
import moe.fuqiuluo.entries.MethodEnum.valueOf | ||
import moe.qwq.miko.actions.IAction | ||
import moe.qwq.miko.ext.hookMethod | ||
import moe.qwq.miko.internals.helper.DvmLocator | ||
import moe.qwq.miko.internals.setting.QwQSetting | ||
import moe.qwq.miko.internals.setting.QwQSetting.ONE_KEY_LIKE | ||
import java.lang.reflect.Method | ||
|
||
|
||
class OneClickLike: IAction { | ||
override fun invoke(ctx: Context) { | ||
val setting = QwQSetting.getSetting(ONE_KEY_LIKE) | ||
runCatching { | ||
val vote = DvmLocator.findMethod(VoteHelperVote) | ||
val voteHelperField = VisitorsActivity::class.java.declaredFields.firstOrNull { | ||
it.type == VoteHelper::class.java | ||
} | ||
if (voteHelperField == null || vote == null) { | ||
setting.isFailed = true | ||
return | ||
} | ||
|
||
if (!QwQSetting.oneClickLike) return@runCatching | ||
|
||
VisitorsActivity::class.java.hookMethod("onClick").before { | ||
val view = it.args[0] as View | ||
val profile = view.tag | ||
if (profile == null || profile !is CardProfile) return@before | ||
val voteHelper = voteHelperField.get(it.thisObject) as VoteHelper | ||
for (i in 0..20) { | ||
vote.invoke(voteHelper, profile, view) | ||
} | ||
it.result = Unit | ||
} | ||
|
||
AbsProfileHeaderComponent::class.java.hookMethod("handleVoteBtnClickForGuestProfile").before { | ||
val selfMethod = it.method as Method | ||
if (!selfMethod.isAccessible) { | ||
selfMethod.isAccessible = true | ||
} | ||
for (i in 0..19) { | ||
selfMethod.invoke(it.thisObject, it.args[0]) | ||
} | ||
} | ||
}.onFailure { | ||
setting.isFailed = true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
qqinterface/src/main/java/com/tencent/mobileqq/activity/VisitorsActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.tencent.mobileqq.activity; | ||
|
||
public class VisitorsActivity { | ||
} |
4 changes: 4 additions & 0 deletions
4
qqinterface/src/main/java/com/tencent/mobileqq/data/CardProfile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.tencent.mobileqq.data; | ||
|
||
public class CardProfile { | ||
} |
7 changes: 7 additions & 0 deletions
7
qqinterface/src/main/java/com/tencent/mobileqq/profile/vote/VoteHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.tencent.mobileqq.profile.vote; | ||
|
||
public class VoteHelper { | ||
|
||
|
||
|
||
} |
4 changes: 4 additions & 0 deletions
4
.../main/java/com/tencent/mobileqq/profilecard/base/component/AbsProfileHeaderComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.tencent.mobileqq.profilecard.base.component; | ||
|
||
public class AbsProfileHeaderComponent { | ||
} |