fix: Revert previous release

The previous release depends on a version of ReVanced Patcher which prevents usage of resource patches on lower Android versions. To solve this issue temporarily, until a fix is present, the previous release is reverted.
This commit is contained in:
oSumAtrIX
2023-08-27 04:37:21 +02:00
parent ce2e46a7cb
commit 3938f2f1b3
496 changed files with 2551 additions and 2425 deletions
@@ -3,7 +3,9 @@ package app.revanced.patches.twitter.misc.dynamiccolor.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.twitter.misc.dynamiccolor.annotations.DynamicColorCompatibility
@@ -15,9 +17,9 @@ import java.nio.file.Files
@Description("Replaces the default Twitter Blue with the users Material You palette.")
@DynamicColorCompatibility
class DynamicColorPatch : ResourcePatch {
override fun execute(context: ResourceContext) {
override fun execute(context: ResourceContext): PatchResult {
val resDirectory = context["res"]
if (!resDirectory.isDirectory) throw PatchException("The res folder can not be found.")
if (!resDirectory.isDirectory) return PatchResultError("The res folder can not be found.")
val valuesV31Directory = resDirectory.resolve("values-v31")
if (!valuesV31Directory.isDirectory) Files.createDirectories(valuesV31Directory.toPath())
@@ -77,5 +79,7 @@ class DynamicColorPatch : ResourcePatch {
document.getElementsByTagName("resources").item(0).appendChild(colorElement)
}
}
return PatchResultSuccess()
}
}
@@ -1,7 +1,7 @@
package app.revanced.patches.twitter.misc.hook.json.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.Opcode
import org.jf.dexlib2.Opcode
object JsonHookPatchFingerprint : MethodFingerprint(
customFingerprint = { methodDef, _ -> methodDef.name == "<clinit>" },
@@ -8,7 +8,9 @@ import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.RequiresIntegrations
import app.revanced.patches.twitter.misc.hook.json.fingerprints.JsonHookPatchFingerprint
import app.revanced.patches.twitter.misc.hook.json.fingerprints.JsonInputStreamFingerprint
@@ -22,14 +24,14 @@ import java.io.InvalidClassException
class JsonHookPatch : BytecodePatch(
listOf(LoganSquareFingerprint)
), Closeable {
override fun execute(context: BytecodeContext) {
override fun execute(context: BytecodeContext): PatchResult {
JsonHookPatchFingerprint.also {
// Make sure the integrations are present.
val jsonHookPatch = context.findClass { classDef -> classDef.type == JSON_HOOK_PATCH_CLASS_DESCRIPTOR }
?: throw PatchException("Could not find integrations.")
?: throw PatchResultError("Could not find integrations.")
if (!it.resolve(context, jsonHookPatch.immutableClass))
throw PatchException("Unexpected integrations.")
throw PatchResultError("Unexpected integrations.")
}.let { hooks = JsonHookPatchHook(it) }
// Conveniently find the type to hook a method in, via a named field.
@@ -40,7 +42,7 @@ class JsonHookPatch : BytecodePatch(
?.type
.let { type ->
context.findClass { it.type == type }?.mutableClass
} ?: throw PatchException("Could not find required class.")
} ?: return PatchResultError("Could not find required class.")
// Hook the methods first parameter.
JsonInputStreamFingerprint
@@ -53,7 +55,9 @@ class JsonHookPatch : BytecodePatch(
invoke-static { p1 }, $JSON_HOOK_PATCH_CLASS_DESCRIPTOR->parseJsonHook(Ljava/io/InputStream;)Ljava/io/InputStream;
move-result-object p1
"""
) ?: throw PatchException("Could not find method to hook.")
) ?: return PatchResultError("Could not find method to hook.")
return PatchResultSuccess()
}
/**
@@ -2,9 +2,16 @@ package app.revanced.patches.twitter.misc.hook.patch
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.twitter.misc.hook.json.patch.JsonHookPatch
abstract class BaseHookPatchPatch(private val hookClassDescriptor: String) : BytecodePatch() {
override fun execute(context: BytecodeContext) =
override fun execute(context: BytecodeContext) = try {
JsonHookPatch.hooks.addHook(JsonHookPatch.Hook(context, hookClassDescriptor))
PatchResultSuccess()
} catch (ex: Exception) {
PatchResultError(ex)
}
}