Skip to content

Commit

Permalink
fix: AutoReceiveOriginalPhoto on QQ 8.9.63+
Browse files Browse the repository at this point in the history
  • Loading branch information
fusumayuki committed Aug 16, 2024
1 parent 52cd93d commit 849a3df
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
6 changes: 6 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 @@ -1010,3 +1010,9 @@ data object Hd_GagInfoDisclosure_Method : DexKitTarget.UsingStr() {
override val declaringClass = "com.tencent.imcore.message"
override val filter = DexKitFilter.strInClsName("com/tencent/imcore/message/")
}

data object OriginalPhotoNT_onInitView : DexKitTarget.UsingDexkit() {
override val findMethod: Boolean = true
override val declaringClass = ""
override val filter: dexkitFilter = DexKitFilter.allowAll
}
16 changes: 14 additions & 2 deletions app/src/main/java/xyz/nextalone/hook/AutoReceiveOriginalPhoto.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import io.github.qauxv.util.dexkit.DexKitFinder
import io.github.qauxv.util.dexkit.DexMethodDescriptor.getTypeSig
import io.github.qauxv.util.dexkit.NAIOPictureView_onDownloadOriginalPictureClick
import io.github.qauxv.util.dexkit.NAIOPictureView_setVisibility
import io.github.qauxv.util.dexkit.OriginalPhotoNT_onInitView
import io.github.qauxv.util.requireMinQQVersion
import io.github.qauxv.util.requireMinVersion
import org.luckypray.dexkit.result.ClassData
Expand All @@ -60,7 +61,8 @@ object AutoReceiveOriginalPhoto : CommonSwitchFunctionHook(

override fun initOnce(): Boolean {
if (requireMinQQVersion(QQVersion.QQ_8_9_63)) {
Initiator.loadClass("com.tencent.qqnt.aio.gallery.part.d").declaredMethods.single { method ->
// Initiator.loadClass("com.tencent.qqnt.aio.gallery.part.d").declaredMethods.single { method ->
DexKit.requireMethodFromCache(OriginalPhotoNT_onInitView).declaringClass.declaredMethods.single { method ->
val params = method.parameterTypes
params.size == 1 && params[0] == Int::class.java
}.hookAfter {
Expand Down Expand Up @@ -112,11 +114,21 @@ object AutoReceiveOriginalPhoto : CommonSwitchFunctionHook(
}

override val isNeedFind: Boolean
get() = NAIOPictureView_onDownloadOriginalPictureClick.descCache == null
get() = NAIOPictureView_onDownloadOriginalPictureClick.descCache == null || (requireMinQQVersion(QQVersion.QQ_8_9_63) && OriginalPhotoNT_onInitView.descCache == null)

override fun doFind(): Boolean {
getCurrentBackend().use { backend ->
val dexKit = backend.getDexKitBridge()
if (requireMinQQVersion(QQVersion.QQ_8_9_63)) {
dexKit.findMethod {
matcher {
name = "onInitView"
usingStrings("rootView", "em_bas_view_the_original_picture")
}
}.firstOrNull()?.let {
OriginalPhotoNT_onInitView.descCache = it.descriptor
} ?: return false
}
var kAIOPictureView = DexKit.loadClassFromCache(CAIOPictureView)
if (kAIOPictureView == null) {
val clazzList = mutableListOf<ClassData>().apply {
Expand Down

0 comments on commit 849a3df

Please sign in to comment.