refactor(pandora): DisableAudioAdsPatch

This commit is contained in:
Pun Butrach 2026-01-11 23:45:21 +07:00
parent b6d1f1c62a
commit b174421e2b
2 changed files with 17 additions and 16 deletions

View file

@ -1,16 +1,16 @@
package app.revanced.patches.pandora.ads
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.patch.creatingBytecodePatch
import app.revanced.util.returnEarly
@Suppress("unused")
val disableAudioAdsPatch = bytecodePatch(
name = "Disable audio ads",
@Suppress("unused", "ObjectPropertyName")
val `Disable Audio Ads` by creatingBytecodePatch(
description = "Disable audio ads"
) {
compatibleWith("com.pandora.android")
apply {
getIsAdSupportedFingerprint.method.returnEarly(false)
requestAudioAdFingerprint.method.returnEarly()
getIsAdSupportedMethod.returnEarly(false)
requestAudioAdMethod.returnEarly()
}
}

View file

@ -1,15 +1,16 @@
package app.revanced.patches.pandora.ads
import app.revanced.patcher.fingerprint
import app.revanced.patcher.BytecodePatchContextMethodMatching.gettingFirstMutableMethodDeclaratively
import app.revanced.patcher.definingClass
import app.revanced.patcher.name
import app.revanced.patcher.patch.BytecodePatchContext
internal val getIsAdSupportedFingerprint = fingerprint {
custom { method, classDef ->
method.name == "getIsAdSupported" && classDef.endsWith("UserData;")
}
internal val BytecodePatchContext.getIsAdSupportedMethod by gettingFirstMutableMethodDeclaratively {
name("getIsAdSupported")
definingClass("UserData;")
}
internal val requestAudioAdFingerprint = fingerprint {
custom { method, classDef ->
method.name == "requestAudioAdFromAdSDK" && classDef.endsWith("ContentServiceOpsImpl;")
}
}
internal val BytecodePatchContext.requestAudioAdMethod by gettingFirstMutableMethodDeclaratively {
name("requestAudioAdFromAdSDK")
definingClass("ContentServiceOpsImpl;"::endsWith)
}