Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

Commit

Permalink
fix: invalid code flow when adding patches
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed May 27, 2022
1 parent 04e0027 commit 206f202
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Release
on:
workflow_dispatch:
push:
branches:
- main
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repositories {

dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.6.21")
implementation("app.revanced:revanced-patcher:1.0.0-dev.16")
implementation("app.revanced:revanced-patcher:1.0.0-dev.17")
implementation("app.revanced:revanced-patches:1.0.0-dev.11")

implementation("info.picocli:picocli:4.6.3")
Expand Down Expand Up @@ -68,4 +68,4 @@ publishing {
from(components["java"])
}
}
}
}
4 changes: 2 additions & 2 deletions src/main/kotlin/app/revanced/cli/MainCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ internal object MainCommand : Runnable {
for (it in JarPatchBundle(patchBundlePath).loadPatches())
println(
"[available] ${
it.javaClass.findAnnotationRecursively(
it.findAnnotationRecursively(
Name::class.java
)?.name ?: Name::class.java.name
)?.name ?: it::class.java.name
}"
)
return
Expand Down
9 changes: 5 additions & 4 deletions src/main/kotlin/app/revanced/utils/patcher/Patcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fun Patcher.addPatchesFiltered(

val compatibilityAnnotation = patch.javaClass.findAnnotationRecursively(Compatibility::class.java)

val patchName = patch.javaClass.findAnnotationRecursively(Name::class.java)?.name ?: Name::class.java.name
val patchName = patch.javaClass.findAnnotationRecursively(Name::class.java)?.name ?: patch.javaClass.name

val prefix = "[skipped] $patchName"

Expand All @@ -47,9 +47,10 @@ fun Patcher.addPatchesFiltered(
return@patch
}

if (!packageVersionCompatibilityFilter || compatiblePackage.versions.any { it == packageVersion }) return@patch
println("$prefix: Unsupported version.")
return@patch
if (packageVersionCompatibilityFilter && !compatiblePackage.versions.any { it == packageVersion }) {
println("$prefix: Unsupported version.")
return@patch
}
}
}

Expand Down

0 comments on commit 206f202

Please sign in to comment.