Skip to content

Commit

Permalink
fix: DisableGrowHalfLayer test2 and printStackTrace
Browse files Browse the repository at this point in the history
  • Loading branch information
HdShare committed Nov 9, 2024
1 parent e03234a commit 202c771
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ data object Hd_AutoSendOriginalPhoto_photoListPanel_Method : DexKitTarget.UsingS
override val filter = DexKitFilter.allowAll
}

data object Hd_DisableGrowHalfLayer_Method : DexKitTarget.UsingStringVector() {
data object Hd_DisableGrowHalfLayer_Method1 : DexKitTarget.UsingStringVector() {
override val findMethod = true
override val traitStringVectors = arrayOf(arrayOf("grow_half_layer_info", "grow_half_layer_tech_info"))
override val declaringClass = "cooperation.vip.ad.GrowHalfLayerHelper"
Expand All @@ -1012,6 +1012,13 @@ data object Hd_DisableGrowHalfLayer_Method : DexKitTarget.UsingStringVector() {
}
}

data object Hd_DisableGrowHalfLayer_Method2 : DexKitTarget.UsingStr() {
override val findMethod = true
override val traitString = arrayOf("start showVasADBanner")
override val declaringClass = "cooperation.vip.qqbanner.manager.VasADBannerManager"
override val filter = DexKitFilter.allowAll
}

data object Hd_GagInfoDisclosure_Method : DexKitTarget.UsingStr() {
override val findMethod = true
override val traitString = arrayOf("<---0x2dc push groupCode:")
Expand Down
27 changes: 24 additions & 3 deletions app/src/main/java/me/hd/hook/DisableGrowHalfLayer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,20 @@ import io.github.qauxv.base.annotation.UiItemAgentEntry
import io.github.qauxv.dsl.FunctionEntryRouter
import io.github.qauxv.hook.CommonSwitchFunctionHook
import io.github.qauxv.util.QQVersion
import io.github.qauxv.util.Toasts
import io.github.qauxv.util.dexkit.DexKit
import io.github.qauxv.util.dexkit.Hd_DisableGrowHalfLayer_Method
import io.github.qauxv.util.dexkit.Hd_DisableGrowHalfLayer_Method1
import io.github.qauxv.util.dexkit.Hd_DisableGrowHalfLayer_Method2
import io.github.qauxv.util.requireMinQQVersion
import io.github.qauxv.util.xpcompat.XposedBridge

@FunctionHookEntry
@UiItemAgentEntry
object DisableGrowHalfLayer : CommonSwitchFunctionHook(
targets = arrayOf(Hd_DisableGrowHalfLayer_Method)
targets = arrayOf(
Hd_DisableGrowHalfLayer_Method1,
Hd_DisableGrowHalfLayer_Method2,
)
) {

override val name = "屏蔽广告弹窗(测试版)"
Expand All @@ -44,9 +50,24 @@ object DisableGrowHalfLayer : CommonSwitchFunctionHook(
override val isAvailable = requireMinQQVersion(QQVersion.QQ_8_9_88)

override fun initOnce(): Boolean {
hookBeforeIfEnabled(DexKit.requireMethodFromCache(Hd_DisableGrowHalfLayer_Method)) { param ->
hookBeforeIfEnabled(DexKit.requireMethodFromCache(Hd_DisableGrowHalfLayer_Method1)) { param ->
printStackTrace("屏蔽广告弹窗 -> 测试1")
Toasts.show("屏蔽广告弹窗 -> 测试1成功")
param.result = null
}
hookBeforeIfEnabled(DexKit.requireMethodFromCache(Hd_DisableGrowHalfLayer_Method2)) { param ->
printStackTrace("屏蔽广告弹窗 -> 测试2")
Toasts.show("屏蔽广告弹窗 -> 测试2成功")
param.result = null
}
return true
}

private fun printStackTrace(name: String) {
val stackTrace = Throwable().stackTrace
val stackTraceStr = stackTrace.joinToString("\n") { element ->
"at ${element.className}.${element.methodName}(${element.fileName}:${element.lineNumber})"
}
XposedBridge.log("[$name] -> $stackTraceStr")
}
}

0 comments on commit 202c771

Please sign in to comment.