fix(Check environment): Use another (also more suitable) API to circumvent a bug

This commit is contained in:
oSumAtrIX 2026-03-05 22:26:14 +01:00
parent 380be33fed
commit 393700f74a
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
2 changed files with 5 additions and 4 deletions

View file

@ -29,7 +29,7 @@ fun checkEnvironmentPatch(
) = bytecodePatch( ) = bytecodePatch(
description = "Checks, if the application was patched by, otherwise warns the user.", description = "Checks, if the application was patched by, otherwise warns the user.",
) { ) {
compatibleWith(*compatiblePackages) compatibleWith(packages = compatiblePackages)
dependsOn( dependsOn(
extensionPatch, extensionPatch,
@ -41,7 +41,7 @@ fun checkEnvironmentPatch(
fun setPatchInfo() { fun setPatchInfo() {
fun <T : MutableEncodedValue> MutableClassDef.setClassFields(vararg fieldNameValues: Pair<String, T>) { fun <T : MutableEncodedValue> MutableClassDef.setClassFields(vararg fieldNameValues: Pair<String, T>) {
val fieldNameValueMap = mapOf(*fieldNameValues) val fieldNameValueMap = mapOf(pairs = fieldNameValues)
fields.forEach { field -> fields.forEach { field ->
field.initialValue = fieldNameValueMap[field.name] ?: return@forEach field.initialValue = fieldNameValueMap[field.name] ?: return@forEach

View file

@ -1,12 +1,13 @@
package app.revanced.patches.shared.misc.checks package app.revanced.patches.shared.misc.checks
import app.revanced.patcher.gettingFirstClassDef
import app.revanced.patcher.gettingFirstClassDefDeclaratively import app.revanced.patcher.gettingFirstClassDefDeclaratively
import app.revanced.patcher.patch.BytecodePatchContext import app.revanced.patcher.patch.BytecodePatchContext
internal val BytecodePatchContext.patchInfoClassDef by gettingFirstClassDefDeclaratively( internal val BytecodePatchContext.patchInfoClassDef by gettingFirstClassDef(
"Lapp/revanced/extension/shared/checks/PatchInfo;" "Lapp/revanced/extension/shared/checks/PatchInfo;"
) )
internal val BytecodePatchContext.patchInfoBuildClassDef by gettingFirstClassDefDeclaratively( internal val BytecodePatchContext.patchInfoBuildClassDef by gettingFirstClassDef(
$$"Lapp/revanced/extension/shared/checks/PatchInfo$Build;" $$"Lapp/revanced/extension/shared/checks/PatchInfo$Build;"
) )