Skip to content

Commit

Permalink
fix(youtube/video-ads): revert faulty method patch (#820)
Browse files Browse the repository at this point in the history
  • Loading branch information
OxrxL committed Oct 20, 2022
1 parent dbfa222 commit ddfc18a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 33 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand All @@ -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()
Expand Down

0 comments on commit ddfc18a

Please sign in to comment.