Skip to content

Commit

Permalink
misc 更新广告过滤机制
Browse files Browse the repository at this point in the history
  • Loading branch information
chr233 committed Jul 5, 2023
1 parent 4018697 commit ebcee94
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 51 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/chr233/PureNGA/android.yml?logo=github)
[![License](https://img.shields.io/github/license/chr233/PureNGA?logo=apache)](https://github.com/chr233/PureNGA/blob/master/license)

[![GitHub Release](https://img.shields.io/github/v/release/chr233/PureNGA?logo=github)](https://github.com/chr233/ASFEnhance/releases)
[![GitHub Release](https://img.shields.io/github/v/release/chr233/PureNGA?logo=github)](https://github.com/chr233/PureNGA/releases)
[![GitHub Release](https://img.shields.io/github/v/release/chr233/PureNGA?include_prereleases&label=pre-release&logo=github)](https://github.com/chr233/PureNGA/releases)
![GitHub last commit](https://img.shields.io/github/last-commit/chr233/PureNGA?logo=github)

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ android {
applicationId "com.chrxw.purenga"
minSdk 24
targetSdk 33
versionCode 5
versionName "1.3.0"
versionCode 6
versionName "1.4.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
proguardFiles
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/chrxw/purenga/XposedInit.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.chrxw.purenga

import android.content.res.Resources
import android.content.res.XModuleResources
import com.chrxw.purenga.hook.AdHook
import com.chrxw.purenga.hook.VipHook
import com.chrxw.purenga.hook.BaseHook
import com.chrxw.purenga.hook.RewardHook
Expand Down Expand Up @@ -40,6 +41,7 @@ class XposedInit : IXposedHookLoadPackage, IXposedHookZygoteInit {
startHook(SplashHook(lpparam.classLoader))
startHook(RewardHook(lpparam.classLoader))
startHook(VipHook(lpparam.classLoader))
startHook(AdHook(lpparam.classLoader))
}
}

Expand Down
55 changes: 7 additions & 48 deletions app/src/main/java/com/chrxw/purenga/hook/AdHook.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.chrxw.purenga.hook

import android.widget.Toast
import com.chrxw.purenga.utils.Log
import de.robv.android.xposed.XC_MethodReplacement
import de.robv.android.xposed.XposedHelpers
Expand All @@ -11,57 +12,15 @@ import de.robv.android.xposed.XposedHelpers
class AdHook(classLoader: ClassLoader) : BaseHook(classLoader) {
override fun startHook() {
try {
val clsB = XposedHelpers.findClass(
"com.nga.admodule.AdManager\$b",
mClassLoader
)
XposedHelpers.findAndHookMethod(
clsB,
"onAdLoad",
"com.donews.admediation.adimpl.feed.DnFeedAd",
mClassLoader,
"requestServerSuccess",
object : XC_MethodReplacement() {
@Throws(Throwable::class)
override fun replaceHookedMethod(param: MethodHookParam) {
Log.i("onAdLoad ")
override fun replaceHookedMethod(param: MethodHookParam?) {
Log.i("DnFeedAd.requestServerSuccess")
}
}
)
XposedHelpers.findAndHookMethod(
clsB,
"onAdShow",
object : XC_MethodReplacement() {
@Throws(Throwable::class)
override fun replaceHookedMethod(param: MethodHookParam) {
Log.i("onAdShow ")
}
}
)

val clsD = XposedHelpers.findClass(
"com.nga.admodule.AdManager\$d",
mClassLoader
)
XposedHelpers.findAndHookMethod(
clsD,
"onAdLoad",
object : XC_MethodReplacement() {
@Throws(Throwable::class)
override fun replaceHookedMethod(param: MethodHookParam) {
Log.i("onAdLoad ")
}
}
)
XposedHelpers.findAndHookMethod(
clsD,
"onAdShow",
object : XC_MethodReplacement() {
@Throws(Throwable::class)
override fun replaceHookedMethod(param: MethodHookParam) {
Log.i("onAdShow ")
}
}
)


})
} catch (e: Exception) {
Log.e(e)
}
Expand Down

0 comments on commit ebcee94

Please sign in to comment.