Skip to content

Commit

Permalink
fix: callback only when inteded
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Jun 23, 2022
1 parent 3d61dac commit e3bf367
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/kotlin/app/revanced/patcher/Patcher.kt
Expand Up @@ -128,8 +128,7 @@ class Patcher(private val options: PatcherOptions) {
callback: (File) -> Unit
) {
for (file in files) {
callback(file)

val modified = false
for (classDef in MultiDexIO.readDexFile(true, file, NAMER, null, null).classes) {
val type = classDef.type

Expand All @@ -139,7 +138,7 @@ class Patcher(private val options: PatcherOptions) {

logger.trace("Merging $type")
data.bytecodeData.classes.internalClasses.add(classDef)

modified = true

continue
}
Expand All @@ -150,8 +149,9 @@ class Patcher(private val options: PatcherOptions) {

val index = existingClass.second
data.bytecodeData.classes.internalClasses[index] = classDef

modified = true
}
if (modified) callback(file)
}
}

Expand Down Expand Up @@ -324,4 +324,4 @@ private fun BuildOptions.setBuildOptions(options: PatcherOptions) {
this.aaptPath = options.aaptPath
this.useAapt2 = true
this.frameworkFolderLocation = options.frameworkFolderLocation
}
}

0 comments on commit e3bf367

Please sign in to comment.