mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-05-15 02:47:05 +02:00

BREAKING CHANGE: Patch options now use the PatchOptions registry class instead of an Iterable. This change requires modifications to existing patches using this API.
25 lines
710 B
Kotlin
25 lines
710 B
Kotlin
package app.revanced.patcher.patch
|
|
|
|
import app.revanced.patcher.data.Data
|
|
import app.revanced.patcher.patch.impl.BytecodePatch
|
|
import app.revanced.patcher.patch.impl.ResourcePatch
|
|
import java.io.Closeable
|
|
|
|
/**
|
|
* A ReVanced patch.
|
|
*
|
|
* Can either be a [ResourcePatch] or a [BytecodePatch].
|
|
* If it implements [Closeable], it will be closed after all patches have been executed.
|
|
* Closing will be done in reverse execution order.
|
|
*/
|
|
abstract class Patch<out T : Data> {
|
|
/**
|
|
* The main function of the [Patch] which the patcher will call.
|
|
*/
|
|
abstract fun execute(data: @UnsafeVariance T): PatchResult
|
|
|
|
/**
|
|
* A list of [PatchOption]s.
|
|
*/
|
|
open val options = PatchOptions()
|
|
} |