Skip to content

Commit

Permalink
fix: missing extension method doRecursively
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed May 31, 2022
1 parent 8a0ee03 commit e9c9460
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/main/kotlin/app/revanced/extensions/Extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package app.revanced.extensions

import app.revanced.patcher.util.smali.toInstruction
import org.jf.dexlib2.builder.MutableMethodImplementation
import org.w3c.dom.Node

internal fun MutableMethodImplementation.injectHideCall(
index: Int,
Expand All @@ -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 {
for (_prefix in prefix)
if (this.startsWith(_prefix))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package app.revanced.patches.youtube.misc.mapping.patch

import app.revanced.extensions.doRecursively
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.ResourceData
import app.revanced.patcher.patch.implementation.ResourcePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patches.youtube.ad.general.resource.util.Extensions.doRecursively
import org.w3c.dom.Element

@Name("resource-id-mapping-provider-resource-patch-dependency")
Expand Down

0 comments on commit e9c9460

Please sign in to comment.