From e3bf367ad6615b30b06027d65f906b2588567a7f Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Thu, 23 Jun 2022 08:54:47 +0200 Subject: [PATCH] fix: callback only when inteded --- src/main/kotlin/app/revanced/patcher/Patcher.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/app/revanced/patcher/Patcher.kt b/src/main/kotlin/app/revanced/patcher/Patcher.kt index 7f878fac..e74930af 100644 --- a/src/main/kotlin/app/revanced/patcher/Patcher.kt +++ b/src/main/kotlin/app/revanced/patcher/Patcher.kt @@ -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 @@ -139,7 +138,7 @@ class Patcher(private val options: PatcherOptions) { logger.trace("Merging $type") data.bytecodeData.classes.internalClasses.add(classDef) - + modified = true continue } @@ -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) } } @@ -324,4 +324,4 @@ private fun BuildOptions.setBuildOptions(options: PatcherOptions) { this.aaptPath = options.aaptPath this.useAapt2 = true this.frameworkFolderLocation = options.frameworkFolderLocation -} \ No newline at end of file +}