mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-05-01 15:14:27 +02:00
fix(video-ads): return empty list in correct method
This commit is contained in:
parent
7752b962ef
commit
1159406c05
@ -5,14 +5,15 @@ import app.revanced.patcher.annotation.Version
|
|||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility
|
import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
@Name("load-ads-fingerprint")
|
@Name("load-ads-fingerprint")
|
||||||
|
|
||||||
@VideoAdsCompatibility
|
@VideoAdsCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
object LoadAdsFingerprint : MethodFingerprint(
|
object LoadAdsFingerprint : MethodFingerprint(
|
||||||
strings = listOf("Unexpected playerAd type: "),
|
opcodes = listOf(Opcode.INVOKE_INTERFACE_RANGE),
|
||||||
customFingerprint = { method ->
|
customFingerprint = { method ->
|
||||||
method.parameterTypes.size > 0 && method.parameterTypes.first() == "Ljava/lang/String;"
|
method.parameterTypes.size > 0 && method.parameterTypes.first().endsWith("InstreamAdBreak;")
|
||||||
}
|
}
|
||||||
)
|
)
|
@ -41,19 +41,20 @@ class VideoAdsPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
LoadAdsFingerprint.result!!.mutableMethod.let { method ->
|
with(LoadAdsFingerprint.result!!) {
|
||||||
method.addInstructions(
|
val insertIndex = scanResult.patternScanResult!!.startIndex
|
||||||
0,
|
with(mutableMethod) {
|
||||||
"""
|
addInstructions(
|
||||||
invoke-static { }, Lapp/revanced/integrations/patches/VideoAdsPatch;->shouldShowAds()Z
|
insertIndex,
|
||||||
move-result v1
|
"""
|
||||||
if-nez v1, :show_video_ads
|
invoke-static { }, Lapp/revanced/integrations/patches/VideoAdsPatch;->shouldShowAds()Z
|
||||||
new-instance v3, Ljava/util/ArrayList;
|
move-result v4
|
||||||
invoke-direct { v3 }, Ljava/util/ArrayList;-><init>()V
|
if-nez v4, :show_video_ads
|
||||||
return-object v3
|
return-object v3
|
||||||
""",
|
""",
|
||||||
listOf(ExternalLabel("show_video_ads", method.instruction(0)))
|
listOf(ExternalLabel("show_video_ads", instruction(insertIndex)))
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user