From 13ec023d7d0f96b448053c607a094b72d5506682 Mon Sep 17 00:00:00 2001 From: Radiquum Date: Thu, 4 Sep 2025 15:37:01 +0500 Subject: [PATCH] feat [R] Change version (build number) Patch Fixes #7 --- patches/change_app_version.config.json | 4 +++ patches/change_app_version.py | 50 ++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 patches/change_app_version.config.json create mode 100644 patches/change_app_version.py diff --git a/patches/change_app_version.config.json b/patches/change_app_version.config.json new file mode 100644 index 0000000..d2ddc6d --- /dev/null +++ b/patches/change_app_version.config.json @@ -0,0 +1,4 @@ +{ + "version_code": 25082901, + "version_name": "9.0 BETA 7" +} \ No newline at end of file diff --git a/patches/change_app_version.py b/patches/change_app_version.py new file mode 100644 index 0000000..1ba1049 --- /dev/null +++ b/patches/change_app_version.py @@ -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