fix: missing extension method doRecursively

This commit is contained in:
oSumAtrIX 2022-06-01 01:50:01 +02:00
parent 8a0ee03a71
commit e9c946008e
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
2 changed files with 7 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package app.revanced.extensions
import app.revanced.patcher.util.smali.toInstruction import app.revanced.patcher.util.smali.toInstruction
import org.jf.dexlib2.builder.MutableMethodImplementation import org.jf.dexlib2.builder.MutableMethodImplementation
import org.w3c.dom.Node
internal fun MutableMethodImplementation.injectHideCall( internal fun MutableMethodImplementation.injectHideCall(
index: Int, index: Int,
@ -13,6 +14,11 @@ internal fun MutableMethodImplementation.injectHideCall(
) )
} }
internal fun Node.doRecursively(action: (Node) -> Unit) {
action(this)
for (i in 0 until this.childNodes.length) this.childNodes.item(i).doRecursively(action)
}
internal fun String.startsWithAny(vararg prefix: String): Boolean { internal fun String.startsWithAny(vararg prefix: String): Boolean {
for (_prefix in prefix) for (_prefix in prefix)
if (this.startsWith(_prefix)) if (this.startsWith(_prefix))

View File

@ -1,5 +1,6 @@
package app.revanced.patches.youtube.misc.mapping.patch package app.revanced.patches.youtube.misc.mapping.patch
import app.revanced.extensions.doRecursively
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
@ -7,7 +8,6 @@ import app.revanced.patcher.data.implementation.ResourceData
import app.revanced.patcher.patch.implementation.ResourcePatch import app.revanced.patcher.patch.implementation.ResourcePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patches.youtube.ad.general.resource.util.Extensions.doRecursively
import org.w3c.dom.Element import org.w3c.dom.Element
@Name("resource-id-mapping-provider-resource-patch-dependency") @Name("resource-id-mapping-provider-resource-patch-dependency")