fix(youtube/video-ads): add back initial method to block ads (#818)
This commit is contained in:
parent
a6eed119d8
commit
8943905373
|
@ -7,10 +7,9 @@ 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
|
||||||
|
|
||||||
@Name("load-ads-fingerprint")
|
@Name("load-ads-fingerprint")
|
||||||
|
|
||||||
@VideoAdsCompatibility
|
@VideoAdsCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
object LoadAdsFingerprint : MethodFingerprint(
|
object LoadVideoAdsFingerprint : MethodFingerprint(
|
||||||
strings = listOf(
|
strings = listOf(
|
||||||
"OnFulfillmentTriggersActivated has non registered slot",
|
"OnFulfillmentTriggersActivated has non registered slot",
|
||||||
"markFillRequested",
|
"markFillRequested",
|
|
@ -0,0 +1,21 @@
|
||||||
|
package app.revanced.patches.youtube.ad.video.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
@Name("load-ads-parent-fingerprint")
|
||||||
|
@VideoAdsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object ShowVideoAdsFingerprint : MethodFingerprint(
|
||||||
|
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("Z"), listOf(
|
||||||
|
Opcode.IPUT_BOOLEAN,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.RETURN_VOID,
|
||||||
|
)
|
||||||
|
)
|
|
@ -13,7 +13,8 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility
|
import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility
|
||||||
import app.revanced.patches.youtube.ad.video.fingerprints.LoadAdsFingerprint
|
import app.revanced.patches.youtube.ad.video.fingerprints.LoadVideoAdsFingerprint
|
||||||
|
import app.revanced.patches.youtube.ad.video.fingerprints.ShowVideoAdsFingerprint
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||||
|
@ -27,7 +28,8 @@ import app.revanced.patches.youtube.misc.settings.framework.components.impl.Swit
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class VideoAdsPatch : BytecodePatch(
|
class VideoAdsPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
LoadAdsFingerprint
|
LoadVideoAdsFingerprint,
|
||||||
|
ShowVideoAdsFingerprint,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
@ -41,7 +43,7 @@ class VideoAdsPatch : BytecodePatch(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
val lithoAdsFingerprintMethod = LoadAdsFingerprint.result!!.mutableMethod
|
val lithoAdsFingerprintMethod = LoadVideoAdsFingerprint.result!!.mutableMethod
|
||||||
|
|
||||||
lithoAdsFingerprintMethod.addInstructions(
|
lithoAdsFingerprintMethod.addInstructions(
|
||||||
0, """
|
0, """
|
||||||
|
@ -52,6 +54,13 @@ class VideoAdsPatch : BytecodePatch(
|
||||||
""", listOf(ExternalLabel("show_video_ads", lithoAdsFingerprintMethod.instruction(0)))
|
""", listOf(ExternalLabel("show_video_ads", lithoAdsFingerprintMethod.instruction(0)))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ShowVideoAdsFingerprint.result!!.mutableMethod.addInstructions(
|
||||||
|
0, """
|
||||||
|
invoke-static { }, Lapp/revanced/integrations/patches/VideoAdsPatch;->shouldShowAds()Z
|
||||||
|
move-result v1
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue