mirror of
https://github.com/Radiquum/anixart-patcher.git
synced 2025-09-07 11:43:51 +05:00
parent
8d58ffaad7
commit
13ec023d7d
2 changed files with 54 additions and 0 deletions
4
patches/change_app_version.config.json
Normal file
4
patches/change_app_version.config.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"version_code": 25082901,
|
||||
"version_name": "9.0 BETA 7"
|
||||
}
|
50
patches/change_app_version.py
Normal file
50
patches/change_app_version.py
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue