diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8a14d97 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Kentai Radiquum + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/patches/add_settings_menu_items.py b/patches/add_settings_menu_items.py index 8d2b0c5..88a7796 100644 --- a/patches/add_settings_menu_items.py +++ b/patches/add_settings_menu_items.py @@ -138,7 +138,7 @@ def add_patch_info(patch_statuses: list): item = create_Preference( patch["name"].replace("_", " ").strip().title(), - description=" ".join(description), + summary = " ".join(description), ) if url: item.append(create_intent(data=url)) diff --git a/patches/change_app_version.py b/patches/change_app_version.py index 1ba1049..d3f890b 100644 --- a/patches/change_app_version.py +++ b/patches/change_app_version.py @@ -7,6 +7,7 @@ priority = -98 # imports ## bundled +import os from typing import TypedDict ## installed @@ -47,4 +48,42 @@ def apply(patch_conf: PatchConfig_ChangeAppVersion) -> bool: ) as f: apktool_yaml = yaml.dump(apktool_yaml, f, indent=2, Dumper=yaml.Dumper) + for root, dirs, files in os.walk(f"{config['folders']['decompiled']}"): + if len(files) < 0: + continue + + for filename in files: + file_path = os.path.join(root, filename) + if os.path.isfile(file_path) and filename.endswith(".smali"): + file_contents = None + with open(file_path, "r", encoding="utf-8") as file: + file_contents = file.read() + + if file_contents.find(str(patch_conf["_internal_app_build"])) >= 0 or file_contents.find( + hex(patch_conf["_internal_app_build"]) + ) >= 0: + file_contents = file_contents.replace( + str(patch_conf["_internal_app_build"]), + str(patch_conf["version_code"]) or str(patch_conf["_internal_app_build"]), + ) + file_contents = file_contents.replace( + hex(patch_conf["_internal_app_build"]), + hex(patch_conf["version_code"]) or hex(patch_conf["_internal_app_build"]), + ) + log.debug(f"replaced build number in file: {file_path}") + log.debug(f"previous: {patch_conf["_internal_app_build"]} ({hex(patch_conf['_internal_app_build'])})") + log.debug(f"replaced: {patch_conf["version_code"]} ({hex(patch_conf['version_code'])})") + + if file_contents.find(patch_conf["_internal_app_version"]) >= 0: + file_contents = file_contents.replace( + patch_conf["_internal_app_version"], + patch_conf["version_name"] or patch_conf["_internal_app_version"], + ) + log.debug(f"replaced version name in file: {file_path}") + log.debug(f"previous: {patch_conf["_internal_app_build"]}") + log.debug(f"replaced: {patch_conf["version_code"]}") + + with open(file_path, "w", encoding="utf-8") as file: + file.write(file_contents) + return True