feat: Add Change version code
patch (#3338)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
d8e44fcba2
commit
685ef39119
|
@ -105,6 +105,12 @@ public final class app/revanced/patches/all/misc/transformation/IMethodCall$Defa
|
||||||
public static fun replaceInvokeVirtualWithIntegrations (Lapp/revanced/patches/all/misc/transformation/IMethodCall;Ljava/lang/String;Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Lcom/android/tools/smali/dexlib2/iface/instruction/formats/Instruction35c;I)V
|
public static fun replaceInvokeVirtualWithIntegrations (Lapp/revanced/patches/all/misc/transformation/IMethodCall;Ljava/lang/String;Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Lcom/android/tools/smali/dexlib2/iface/instruction/formats/Instruction35c;I)V
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final class app/revanced/patches/all/misc/versioncode/ChangeVersionCodePatch : app/revanced/patcher/patch/ResourcePatch {
|
||||||
|
public static final field INSTANCE Lapp/revanced/patches/all/misc/versioncode/ChangeVersionCodePatch;
|
||||||
|
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||||
|
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
|
||||||
|
}
|
||||||
|
|
||||||
public final class app/revanced/patches/all/screencapture/removerestriction/RemoveCaptureRestrictionPatch : app/revanced/patches/all/misc/transformation/BaseTransformInstructionsPatch {
|
public final class app/revanced/patches/all/screencapture/removerestriction/RemoveCaptureRestrictionPatch : app/revanced/patches/all/misc/transformation/BaseTransformInstructionsPatch {
|
||||||
public static final field INSTANCE Lapp/revanced/patches/all/screencapture/removerestriction/RemoveCaptureRestrictionPatch;
|
public static final field INSTANCE Lapp/revanced/patches/all/screencapture/removerestriction/RemoveCaptureRestrictionPatch;
|
||||||
public synthetic fun filterMap (Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;I)Ljava/lang/Object;
|
public synthetic fun filterMap (Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;I)Ljava/lang/Object;
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package app.revanced.patches.all.misc.versioncode
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.intPatchOption
|
||||||
|
import app.revanced.util.getNode
|
||||||
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
|
@Patch(
|
||||||
|
name = "Change version code",
|
||||||
|
description = "Changes the version code of the app. By default the highest version code is set. " +
|
||||||
|
"This allows older versions of an app to be installed " +
|
||||||
|
"if their version code is set to the same or a higher value and can stop app stores to update the app.",
|
||||||
|
use = false,
|
||||||
|
)
|
||||||
|
@Suppress("unused")
|
||||||
|
object ChangeVersionCodePatch : ResourcePatch() {
|
||||||
|
private val versionCode by intPatchOption(
|
||||||
|
key = "versionCode",
|
||||||
|
default = Int.MAX_VALUE,
|
||||||
|
values = mapOf(
|
||||||
|
"Lowest" to 1,
|
||||||
|
"Highest" to Int.MAX_VALUE,
|
||||||
|
),
|
||||||
|
title = "Version code",
|
||||||
|
description = "The version code to use",
|
||||||
|
required = true,
|
||||||
|
) {
|
||||||
|
it!! >= 1
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun execute(context: ResourceContext) {
|
||||||
|
context.document["AndroidManifest.xml"].use { document ->
|
||||||
|
val manifestElement = document.getNode("manifest") as Element
|
||||||
|
manifestElement.setAttribute("android:versionCode", "$versionCode")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue