Skip to content

Commit

Permalink
feat: add or extension for AccessFlags
Browse files Browse the repository at this point in the history
  • Loading branch information
Sculas authored and oSumAtrIX committed Jun 5, 2022
1 parent cb78c5a commit 00c85b5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package app.revanced.patcher.extensions

import org.jf.dexlib2.AccessFlags

infix fun AccessFlags.or(other: AccessFlags) = this.value or other.value
6 changes: 4 additions & 2 deletions src/test/kotlin/patcher/PatcherTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package patcher

import app.revanced.patcher.Patcher
import app.revanced.patcher.cache.Cache
import app.revanced.patcher.extensions.or
import app.revanced.patcher.patch.Patch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
Expand All @@ -18,7 +19,7 @@ fun main() {
MethodSignature(
"main-method",
"V",
AccessFlags.STATIC.value or AccessFlags.PUBLIC.value,
AccessFlags.STATIC or AccessFlags.PUBLIC,
listOf("[O"),
arrayOf(
Opcode.SGET_OBJECT,
Expand Down Expand Up @@ -84,7 +85,8 @@ fun main() {
return PatchResultSuccess()
}
}

patcher.addPatches(mainMethodPatchViaClassProxy, mainMethodPatchViaSignature)
patcher.applyPatches()
patcher.save()
}
}

0 comments on commit 00c85b5

Please sign in to comment.