fix(youtube/video-ads): revert faulty method patch (#820)

This commit is contained in:
OxrxL 2022-10-20 19:04:11 +02:00 committed by GitHub
parent 9ecd4e6ac8
commit 666248ae65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 33 deletions

View file

@ -1,21 +0,0 @@
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,
)
)

View file

@ -14,7 +14,6 @@ import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility
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.settings.bytecode.patch.SettingsPatch
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
@ -29,7 +28,6 @@ import app.revanced.patches.youtube.misc.settings.framework.components.impl.Swit
class VideoAdsPatch : BytecodePatch(
listOf(
LoadVideoAdsFingerprint,
ShowVideoAdsFingerprint,
)
) {
override fun execute(context: BytecodeContext): PatchResult {
@ -43,22 +41,15 @@ class VideoAdsPatch : BytecodePatch(
)
)
val lithoAdsFingerprintMethod = LoadVideoAdsFingerprint.result!!.mutableMethod
val loadVideoAdsFingerprintMethod = LoadVideoAdsFingerprint.result!!.mutableMethod
lithoAdsFingerprintMethod.addInstructions(
loadVideoAdsFingerprintMethod.addInstructions(
0, """
invoke-static { }, Lapp/revanced/integrations/patches/VideoAdsPatch;->shouldShowAds()Z
move-result v0
if-nez v0, :show_video_ads
return-void
""", 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
"""
""", listOf(ExternalLabel("show_video_ads", loadVideoAdsFingerprintMethod.instruction(0)))
)
return PatchResultSuccess()