mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-19 00:53:57 +00:00
refactor(pixiv): HideAdsPatch
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
package app.revanced.patches.pixiv.ads
|
||||
|
||||
import app.revanced.patcher.BytecodePatchContextMethodMatching.gettingFirstMutableMethodDeclaratively
|
||||
import app.revanced.patcher.accessFlags
|
||||
import app.revanced.patcher.definingClass
|
||||
import app.revanced.patcher.name
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import app.revanced.patcher.returnType
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import app.revanced.patcher.fingerprint
|
||||
|
||||
internal val shouldShowAdsFingerprint = fingerprint {
|
||||
internal val BytecodePatchContext.shouldShowAdsMethod by gettingFirstMutableMethodDeclaratively {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returns("Z")
|
||||
custom { methodDef, classDef ->
|
||||
classDef.type.endsWith("AdUtils;") && methodDef.name == "shouldShowAds"
|
||||
}
|
||||
returnType("Z")
|
||||
definingClass("AdUtils;"::endsWith)
|
||||
name("shouldShowAds")
|
||||
}
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package app.revanced.patches.pixiv.ads
|
||||
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
import app.revanced.util.returnEarly
|
||||
|
||||
@Suppress("unused")
|
||||
val hideAdsPatch = bytecodePatch(
|
||||
name = "Hide ads",
|
||||
) {
|
||||
@Suppress("unused", "ObjectPropertyName")
|
||||
val `Hide ads` by creatingBytecodePatch {
|
||||
compatibleWith("jp.pxv.android"("6.141.1"))
|
||||
|
||||
apply {
|
||||
shouldShowAdsFingerprint.method.returnEarly(false)
|
||||
shouldShowAdsMethod.returnEarly(false)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user