Skip to content

Commit

Permalink
simplify api
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Jun 18, 2024
1 parent e2bc302 commit 4affb65
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion api/revanced-patcher.api
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ public final class app/revanced/patcher/PackageMetadata {
public final class app/revanced/patcher/Patcher : java/io/Closeable {
public fun <init> (Lapp/revanced/patcher/PatcherConfig;)V
public fun close ()V
public final fun execute ()Lkotlinx/coroutines/flow/Flow;
public final fun get ()Lapp/revanced/patcher/PatcherResult;
public final fun getContext ()Lapp/revanced/patcher/PatcherContext;
public final fun invoke ()Lkotlinx/coroutines/flow/Flow;
public final fun plusAssign (Lkotlin/Pair;)V
}

Expand Down
6 changes: 3 additions & 3 deletions docs/1_patcher_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ val patcherResult = Patcher(PatcherConfig(apkFile = File("some.apk"))).use { pat

// Execute the patches.
runBlocking {
patcher.execute().collect { patchResult ->
patcher().collect { patchResult ->
if (patchResult.exception != null)
logger.info("\"${patchResult.patchName}\" failed:\n${patchResult.exception}")
logger.info("\"${patchResult.patch}\" failed:\n${patchResult.exception}")
else
logger.info("\"${patchResult.patchName}\" succeeded")
logger.info("\"${patchResult.patch}\" succeeded")
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/app/revanced/patcher/Patcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Patcher(private val config: PatcherConfig) : Closeable {
*
* @return A flow of [PatchResult]s.
*/
fun execute() = flow {
operator fun invoke() = flow {
fun Patch<*>.execute(
executedPatches: LinkedHashMap<Patch<*>, PatchResult>,
): PatchResult {
Expand Down

0 comments on commit 4affb65

Please sign in to comment.