1
0
Fork 0
mirror of https://github.com/Radiquum/anixart-patcher.git synced 2025-09-07 11:43:51 +05:00

feat [R] Change version (build number) Patch

Fixes #7
This commit is contained in:
Kentai Radiquum 2025-09-04 15:37:01 +05:00
parent 8d58ffaad7
commit 13ec023d7d
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
2 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,4 @@
{
"version_code": 25082901,
"version_name": "9.0 BETA 7"
}

View file

@ -0,0 +1,50 @@
"""Changes the version string and build number"""
# Developer: Radiquum
# patch settings
# priority, default: -98
priority = -98
# imports
## bundled
from typing import TypedDict
## installed
import yaml
## custom
from config import config, log
# Patch
class PatchConfig_ChangeAppVersion(TypedDict):
_internal_app_version: str
_internal_app_build: int
version_name: str
version_code: int
def apply(patch_conf: PatchConfig_ChangeAppVersion) -> bool:
apktool_yaml = None
with open(
f"{config['folders']['decompiled']}/apktool.yml", "r", encoding="utf-8"
) as f:
apktool_yaml = yaml.load(f.read(), Loader=yaml.Loader)
apktool_yaml.update(
{
"versionInfo": {
"versionName": patch_conf["version_name"]
or patch_conf["_internal_app_version"],
"versionCode": patch_conf["version_code"]
or patch_conf["_internal_app_build"],
}
}
)
with open(
f"{config['folders']['decompiled']}/apktool.yml", "w", encoding="utf-8"
) as f:
apktool_yaml = yaml.dump(apktool_yaml, f, indent=2, Dumper=yaml.Dumper)
return True