mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-04-30 13:24:26 +02:00
refactor: Simplify fingerprint resolution
This commit is contained in:
parent
aa71146b1b
commit
a1fbb7990f
@ -183,7 +183,7 @@ class Patcher(
|
|||||||
// TODO: Implement this in a more polymorphic way.
|
// TODO: Implement this in a more polymorphic way.
|
||||||
when (patch) {
|
when (patch) {
|
||||||
is BytecodePatch -> {
|
is BytecodePatch -> {
|
||||||
patch.fingerprints.toList().resolveUsingLookupMap(context.bytecodeContext)
|
patch.fingerprints.resolveUsingLookupMap(context.bytecodeContext)
|
||||||
patch.execute(context.bytecodeContext)
|
patch.execute(context.bytecodeContext)
|
||||||
}
|
}
|
||||||
is ResourcePatch -> {
|
is ResourcePatch -> {
|
||||||
|
@ -159,9 +159,12 @@ abstract class MethodFingerprint(
|
|||||||
* - Faster: Specify [accessFlags], [returnType] and [parameters].
|
* - Faster: Specify [accessFlags], [returnType] and [parameters].
|
||||||
* - Fastest: Specify [strings], with at least one string being an exact (non-partial) match.
|
* - Fastest: Specify [strings], with at least one string being an exact (non-partial) match.
|
||||||
*/
|
*/
|
||||||
internal fun List<MethodFingerprint>.resolveUsingLookupMap(context: BytecodeContext) {
|
internal fun Set<MethodFingerprint>.resolveUsingLookupMap(context: BytecodeContext) {
|
||||||
if (methods.isEmpty()) throw PatchException("lookup map not initialized")
|
if (methods.isEmpty()) throw PatchException("lookup map not initialized")
|
||||||
|
|
||||||
|
forEach { fingerprint ->
|
||||||
|
fingerprint.resolveUsingLookupMap(context)
|
||||||
|
}
|
||||||
for (fingerprint in this) {
|
for (fingerprint in this) {
|
||||||
fingerprint.resolveUsingLookupMap(context)
|
fingerprint.resolveUsingLookupMap(context)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user