feat(pixiv): add hide-ads patch (#2578)

Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
Sculas
2023-07-05 23:01:27 +02:00
committed by GitHub
co-authored by oSumAtrIX
parent 04bac73a18
commit 6c55d13c80
2 changed files with 54 additions and 0 deletions
@@ -0,0 +1,21 @@
package app.revanced.patches.pixiv.ads.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
object IsNotPremiumFingerprint : MethodFingerprint(
"V",
AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
listOf("L"),
strings = listOf("pixivAccountManager"),
customFingerprint = custom@{ _, classDef ->
// The "isNotPremium" method is the only method in the class.
if (classDef.virtualMethods.count() != 1) return@custom false
classDef.virtualMethods.first().let { isNotPremiumMethod ->
isNotPremiumMethod.parameterTypes.size == 0 && isNotPremiumMethod.returnType == "Z"
}
}
)