Skip to content

Commit

Permalink
fix: check if packageVersion is compatible with any from `compatibl…
Browse files Browse the repository at this point in the history
…ePackages`
  • Loading branch information
oSumAtrIX committed Jun 12, 2022
1 parent 3878532 commit 32589c8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/kotlin/app/revanced/utils/patcher/Patcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ fun Patcher.addPatchesFiltered(
}

if (compatiblePackages == null) println("$prefix: Missing compatibility annotation. Continuing.")
else compatiblePackages.forEach { compatiblePackage ->
if (compatiblePackage.name != packageName) {
println("$prefix: Package name not matching ${compatiblePackage.name}.")
else {
if (!compatiblePackages.any { it.name == packageName }) {
println("$prefix: Incompatible package.")
return@patch
}

if (!(debugging || compatiblePackage.versions.any { it == packageVersion })) {
println("$prefix: Unsupported version.")
if (!(debugging || compatiblePackages.any { it.versions.isEmpty() || it.versions.any { version -> version == packageVersion }})) {
println("$prefix: The package version is $packageVersion and is incompatible.")
return@patch
}
}
Expand Down

0 comments on commit 32589c8

Please sign in to comment.