diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/general/bytecode/patch/GeneralBytecodeAdsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/general/bytecode/patch/GeneralBytecodeAdsPatch.kt index c09823be5..74c1d73f3 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/general/bytecode/patch/GeneralBytecodeAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/general/bytecode/patch/GeneralBytecodeAdsPatch.kt @@ -21,7 +21,6 @@ import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensi import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensions.insertBlocks import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensions.toDescriptor import app.revanced.patches.youtube.ad.general.bytecode.utils.MethodUtils.createMutableMethod -import app.revanced.patches.youtube.ad.general.resource.patch.GeneralResourceAdsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.mapping.patch.ResourceIdMappingProviderResourcePatch import org.jf.dexlib2.Opcode @@ -40,7 +39,7 @@ import org.jf.dexlib2.immutable.reference.ImmutableMethodReference @Patch @Dependencies( - dependencies = [ResourceIdMappingProviderResourcePatch::class, IntegrationsPatch::class, GeneralResourceAdsPatch::class] + dependencies = [ResourceIdMappingProviderResourcePatch::class, IntegrationsPatch::class] ) @Name("general-ads") @Description("Patch to remove general ads in bytecode.") diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/general/resource/patch/GeneralResourceAdsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/general/resource/patch/GeneralResourceAdsPatch.kt deleted file mode 100644 index bee2ec9c0..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/general/resource/patch/GeneralResourceAdsPatch.kt +++ /dev/null @@ -1,60 +0,0 @@ -package app.revanced.patches.youtube.ad.general.resource.patch - -import app.revanced.extensions.doRecursively -import app.revanced.extensions.startsWithAny -import app.revanced.patcher.annotation.Description -import app.revanced.patcher.annotation.Name -import app.revanced.patcher.annotation.Version -import app.revanced.patcher.data.impl.ResourceData -import app.revanced.patcher.patch.PatchResult -import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.patcher.patch.annotations.Dependencies -import app.revanced.patcher.patch.impl.ResourcePatch -import app.revanced.patches.youtube.ad.general.annotation.GeneralAdsCompatibility -import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch -import org.w3c.dom.Element - -@Dependencies(dependencies = [FixLocaleConfigErrorPatch::class]) -@Name("general-resource-ads") -@Description("Patch to remove general ads in resources.") -@GeneralAdsCompatibility -@Version("0.0.1") -class GeneralResourceAdsPatch : ResourcePatch() { - // list of resource file names which need to be hidden - private val resourceFileNames = arrayOf( - "compact_promoted_video_item.xml", - "inline_muted_metadata_swap.xml", - "interstitial_promo_view.xml", - "pip_ad_overlay.xml", - "promoted_", - "watch_metadata_companion_cards.xml", - //"watch_while_activity.xml" // FIXME: find out why patching this resource fails - ) - - // the attributes to change the value of - private val replacements = arrayOf( - "height", - "width", - "marginTop", - ) - - override fun execute(data: ResourceData): PatchResult { - data.forEach { - if (!it.name.startsWithAny(*resourceFileNames)) return@forEach - - // for each file in the "layouts" directory replace all necessary attributes content - data.xmlEditor[it.absolutePath].use { editor -> - editor.file.doRecursively { node -> - replacements.forEach replacement@{ replacement -> - if (node !is Element) return@replacement - - node.getAttributeNode("android:layout_$replacement")?.let { attribute -> - attribute.textContent = "1.0dip" - } - } - } - } - } - return PatchResultSuccess() - } -} \ No newline at end of file