feat(YouTube Vanced): Remove Hide ads patch

This commit is contained in:
oSumAtrIX 2024-03-04 14:59:32 +01:00
parent e8b54bd0ec
commit 87887e4163
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4

View file

@ -1,6 +1,5 @@
package app.revanced.patches.youtubevanced.ad.general package app.revanced.patches.youtubevanced.ad.general
import app.revanced.util.exception
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
@ -9,17 +8,19 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.misc.fix.verticalscroll.VerticalScrollPatch import app.revanced.patches.shared.misc.fix.verticalscroll.VerticalScrollPatch
import app.revanced.patches.youtubevanced.ad.general.fingerprints.ContainsAdFingerprint import app.revanced.patches.youtubevanced.ad.general.fingerprints.ContainsAdFingerprint
import app.revanced.util.exception
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction21c import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction21c
@Deprecated("This patch is going to be removed in the future.")
@Patch( @Patch(
name = "Hide ads",
description = "Removes general ads.", description = "Removes general ads.",
dependencies = [VerticalScrollPatch::class], dependencies = [VerticalScrollPatch::class],
compatiblePackages = [CompatiblePackage("com.vanced.android.youtube")] compatiblePackages = [CompatiblePackage("com.vanced.android.youtube")],
use = false,
) )
@Suppress("unused") @Suppress("unused")
object HideAdsPatch : BytecodePatch( object HideAdsPatch : BytecodePatch(
setOf(ContainsAdFingerprint) setOf(ContainsAdFingerprint),
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
ContainsAdFingerprint.result?.let { result -> ContainsAdFingerprint.result?.let { result ->
@ -40,14 +41,14 @@ object HideAdsPatch : BytecodePatch(
"hero_promo_image", "hero_promo_image",
"statement_banner", "statement_banner",
"primetime_promo", "primetime_promo",
"carousel_footered_layout" "carousel_footered_layout",
).forEach { component -> ).forEach { component ->
addInstructions( addInstructions(
insertIndex, insertIndex,
""" """
const-string v$adsListRegister, "$component" const-string v$adsListRegister, "$component"
invoke-interface {v0, v$adsListRegister}, Ljava/util/List;->add(Ljava/lang/Object;)Z invoke-interface {v0, v$adsListRegister}, Ljava/util/List;->add(Ljava/lang/Object;)Z
""" """,
) )
} }
} }