mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-05-01 13:44:25 +02:00
fix: check dependencies for resource patches
This commit is contained in:
parent
438321330e
commit
9c07ffcc7a
@ -207,7 +207,7 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
*/
|
*/
|
||||||
fun Class<out Patch<Data>>.isResource() {
|
fun Class<out Patch<Data>>.isResource() {
|
||||||
this.also {
|
this.also {
|
||||||
if (!ResourcePatch::class.java.isAssignableFrom(it)) return
|
if (!ResourcePatch::class.java.isAssignableFrom(it)) return@also
|
||||||
// set the mode to decode all resources before running the patches
|
// set the mode to decode all resources before running the patches
|
||||||
resourceDecodingMode = ResourceDecodingMode.FULL
|
resourceDecodingMode = ResourceDecodingMode.FULL
|
||||||
}.dependencies?.forEach { it.java.isResource() }
|
}.dependencies?.forEach { it.java.isResource() }
|
||||||
@ -249,14 +249,15 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// recursively apply all dependency patches
|
// recursively apply all dependency patches
|
||||||
patch.dependencies?.forEach { dependency ->
|
patch.dependencies?.forEach { dependencyClass ->
|
||||||
val result = applyPatch(dependency.java, appliedPatches)
|
val dependency = dependencyClass.java
|
||||||
|
|
||||||
|
val result = applyPatch(dependency, appliedPatches)
|
||||||
if (result.isSuccess()) return@forEach
|
if (result.isSuccess()) return@forEach
|
||||||
|
|
||||||
val error = result.error()!!
|
val error = result.error()!!
|
||||||
val errorMessage = error.cause ?: error.message
|
val errorMessage = error.cause ?: error.message
|
||||||
return PatchResultError("'$patchName' depends on '${patch.patchName}' but the following error was raised: $errorMessage")
|
return PatchResultError("'$patchName' depends on '${dependency.patchName}' but the following error was raised: $errorMessage")
|
||||||
}
|
}
|
||||||
|
|
||||||
patch.deprecated?.let { (reason, replacement) ->
|
patch.deprecated?.let { (reason, replacement) ->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user