fix(Change version code): change to a universal patch, and changed the patch description

This commit is contained in:
inotia00 2024-07-17 13:57:11 +09:00
parent 2d670c2d36
commit 9ac5d9a055

View File

@ -1,23 +1,24 @@
package app.revanced.patches.reddit.misc.versioncode package app.revanced.patches.all.misc.versioncode
import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchException import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.booleanPatchOption import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.booleanPatchOption
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
import app.revanced.patches.reddit.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.util.patch.BaseResourcePatch
import app.revanced.util.valueOrThrow import app.revanced.util.valueOrThrow
import org.w3c.dom.Element import org.w3c.dom.Element
@Suppress("unused") @Patch(
object ChangeVersionCodePatch : BaseResourcePatch(
name = "Change version code", name = "Change version code",
description = "Changes the version code of the app. By default the highest version code is set. " + 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 " + "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.", "if their version code is set to the same or a higher value and can stop app stores to update the app. " +
compatiblePackages = COMPATIBLE_PACKAGE, "This does not apply when installing with root install (mount).",
use = false use = false,
) { )
@Suppress("unused")
object ChangeVersionCodePatch : ResourcePatch() {
private const val MAX_VALUE = Int.MAX_VALUE.toString() private const val MAX_VALUE = Int.MAX_VALUE.toString()
private val ChangeVersionCode by booleanPatchOption( private val ChangeVersionCode by booleanPatchOption(
@ -66,4 +67,4 @@ object ChangeVersionCodePatch : BaseResourcePatch(
"Invalid versionCode: $versionCodeString, " + "Invalid versionCode: $versionCodeString, " +
"Version code should be larger than 1 and smaller than $MAX_VALUE." "Version code should be larger than 1 and smaller than $MAX_VALUE."
) )
} }