Skip to content

Commit

Permalink
fix: MultiForwardAvatarHook preparation
Browse files Browse the repository at this point in the history
  • Loading branch information
klxiaoniu committed Jul 30, 2023
1 parent 02521b8 commit 66d3640
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions app/src/main/java/cc/ioctl/hook/msg/MultiForwardAvatarHook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import io.github.qauxv.util.dexkit.DexDeobfsProvider.getCurrentBackend
import io.github.qauxv.util.dexkit.DexKit
import io.github.qauxv.util.dexkit.DexKit.loadClassFromCache
import io.github.qauxv.util.dexkit.DexKitFinder
import io.github.qauxv.util.dexkit.DexKitTargetSealedEnum.nameOf
import io.github.qauxv.util.dexkit.Multiforward_Avatar_setListener_NT
import io.github.qauxv.util.requireMinQQVersion
import me.ketal.dispacher.BaseBubbleBuilderHook
Expand All @@ -83,7 +84,8 @@ object MultiForwardAvatarHook : CommonSwitchFunctionHook(arrayOf(CAIOUtils, Mult
private var mChatItemHeadIconViewId = 0


override val isNeedFind = QAppUtils.isQQnt() && Multiforward_Avatar_setListener_NT.descCache == null
override val isNeedFind: Boolean
get() = QAppUtils.isQQnt() && Multiforward_Avatar_setListener_NT.descCache == null

override fun doFind(): Boolean {
getCurrentBackend().use { backend ->
Expand All @@ -95,6 +97,7 @@ object MultiForwardAvatarHook : CommonSwitchFunctionHook(arrayOf(CAIOUtils, Mult
methodName = "setOnClickListener"
}
if (m.size != 1) return false
Log.d("save id: " + nameOf(Multiforward_Avatar_setListener_NT) + ",method: " + m.keys.first().descriptor)
Multiforward_Avatar_setListener_NT.descCache = m.keys.first().descriptor
return true
}
Expand All @@ -118,9 +121,14 @@ object MultiForwardAvatarHook : CommonSwitchFunctionHook(arrayOf(CAIOUtils, Mult
}
}

override fun makePreparationSteps(): Array<Step> {
return arrayOf(mStep)
private val mSteps by lazy {
val steps = mutableListOf(mStep)
super.makePreparationSteps()?.let {
steps.addAll(it)
}
steps.toTypedArray()
}
override fun makePreparationSteps(): Array<Step> = mSteps


@SuppressLint("DiscouragedApi")
Expand Down

0 comments on commit 66d3640

Please sign in to comment.