mirror of
https://github.com/revanced/revanced-manager-compose-old.git
synced 2025-05-01 15:04:26 +02:00
feat: dynamically enable resource decoding
This commit is contained in:
parent
4b796f75ee
commit
336c863c7f
@ -107,7 +107,7 @@ class PatcherWorker(context: Context, parameters: WorkerParameters) :
|
||||
PatcherOptions(
|
||||
inputFile,
|
||||
cacheDirectory.absolutePath,
|
||||
patchResources = false,
|
||||
patchResources = checkForResourcePatch(patches),
|
||||
aaptPath = aaptPath,
|
||||
frameworkFolderLocation = frameworkPath,
|
||||
logger = object : Logger {
|
||||
@ -173,4 +173,18 @@ class PatcherWorker(context: Context, parameters: WorkerParameters) :
|
||||
val (patches) = patches.value as? Resource.Success ?: return listOf()
|
||||
return patches.filter { patch -> ids.any { it == patch.patchName } }
|
||||
}
|
||||
|
||||
private fun checkForResourcePatch(patches: List<Class<out Patch<Data>>>): Boolean {
|
||||
patches.forEach { patch ->
|
||||
patch.dependencies?.forEach {
|
||||
if (ResourcePatch::class.java.isAssignableFrom(patch)) { // check for resource patches in normal patches
|
||||
return true
|
||||
}
|
||||
if (ResourcePatch::class.java.isAssignableFrom(it.java)) { // do the same thing in dependency patches
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user