mirror of
https://github.com/revanced/revanced-manager-compose-old.git
synced 2025-05-02 07:24:27 +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(
|
PatcherOptions(
|
||||||
inputFile,
|
inputFile,
|
||||||
cacheDirectory.absolutePath,
|
cacheDirectory.absolutePath,
|
||||||
patchResources = false,
|
patchResources = checkForResourcePatch(patches),
|
||||||
aaptPath = aaptPath,
|
aaptPath = aaptPath,
|
||||||
frameworkFolderLocation = frameworkPath,
|
frameworkFolderLocation = frameworkPath,
|
||||||
logger = object : Logger {
|
logger = object : Logger {
|
||||||
@ -173,4 +173,18 @@ class PatcherWorker(context: Context, parameters: WorkerParameters) :
|
|||||||
val (patches) = patches.value as? Resource.Success ?: return listOf()
|
val (patches) = patches.value as? Resource.Success ?: return listOf()
|
||||||
return patches.filter { patch -> ids.any { it == patch.patchName } }
|
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