diff --git a/main.py b/main.py index 29d9b88..78c0974 100644 --- a/main.py +++ b/main.py @@ -61,6 +61,11 @@ def select_apk() -> str: print("Нет файлов .apk в текущей директории") sys.exit(1) + if len(apks) == 1: + apk = apks[0] + print(f"Выбран файл {apk}") + return apk + while True: print("Выберете файл для модификации") for index, apk in enumerate(apks): @@ -127,7 +132,7 @@ patch = decompile_apk(apk) patches = [] for filename in os.listdir("patches/"): - if filename.endswith(".py") and filename != "__init__.py": + if filename.endswith(".py") and filename != "__init__.py" and not filename.startswith("todo_"): module_name = filename[:-3] module = importlib.import_module(f"patches.{module_name}") patches.append(Patch(module_name, module)) diff --git a/patches/cleanup.py b/patches/cleanup.py index 2a1ec4a..108555d 100644 --- a/patches/cleanup.py +++ b/patches/cleanup.py @@ -5,6 +5,7 @@ from tqdm import tqdm import os import shutil + def apply(config: dict) -> bool: for item in os.listdir("./decompiled/unknown/"): item_path = os.path.join("./decompiled/unknown/", item) diff --git a/patches/color_theme.py b/patches/color_theme.py index 61cc846..135f76a 100644 --- a/patches/color_theme.py +++ b/patches/color_theme.py @@ -1,9 +1,9 @@ """Change application theme""" priority = 0 -from tqdm import tqdm from lxml import etree + def apply(config: dict) -> bool: main_color = config["theme"]["colors"]["primary"] splash_color = config["theme"]["colors"]["secondary"] diff --git a/patches/compress_png.py b/patches/compress_png.py index 0942451..9fe40d4 100644 --- a/patches/compress_png.py +++ b/patches/compress_png.py @@ -1,5 +1,4 @@ """Compress PNGs""" - priority = -1 from tqdm import tqdm diff --git a/patches/disable_ad.py b/patches/disable_ad.py index 30e8a95..25c8837 100644 --- a/patches/disable_ad.py +++ b/patches/disable_ad.py @@ -1,5 +1,4 @@ """Disable ad banners""" - priority = 0 from utils.smali_parser import ( @@ -9,6 +8,7 @@ from utils.smali_parser import ( replace_smali_method_body, ) + replace = """ .locals 0 const/4 p0, 0x1 diff --git a/patches/disable_beta_banner.py b/patches/disable_beta_banner.py index 2e2d417..a5ee84b 100644 --- a/patches/disable_beta_banner.py +++ b/patches/disable_beta_banner.py @@ -1,8 +1,8 @@ """Remove beta banner""" - priority = 0 -import os from tqdm import tqdm + +import os from lxml import etree from typing import TypedDict diff --git a/patches/insert_new.py b/patches/insert_new.py index 5e4259b..ee1308f 100644 --- a/patches/insert_new.py +++ b/patches/insert_new.py @@ -1,7 +1,5 @@ """Insert new files""" - priority = 0 -from tqdm import tqdm import shutil import os diff --git a/patches/package_name.py b/patches/package_name.py index 6cf5565..a95ecdc 100644 --- a/patches/package_name.py +++ b/patches/package_name.py @@ -1,7 +1,5 @@ """Change package name of apk""" - priority = -1 -from tqdm import tqdm import os diff --git a/patches/settings_urls.py b/patches/settings_urls.py index 8d18f36..5f85190 100644 --- a/patches/settings_urls.py +++ b/patches/settings_urls.py @@ -1,10 +1,9 @@ """Add new settings""" priority = 0 -from tqdm import tqdm from lxml import etree -# Generate PreferenceCategory + def make_category(ns, name, items): cat = etree.Element("PreferenceCategory", nsmap=ns) cat.set(f"{{{ns['android']}}}title", name) diff --git a/patches/application_icon.py b/patches/todo_application_icon.py similarity index 63% rename from patches/application_icon.py rename to patches/todo_application_icon.py index c32849d..64a567f 100644 --- a/patches/application_icon.py +++ b/patches/todo_application_icon.py @@ -1,9 +1,6 @@ """Change application icon""" priority = 0 -from tqdm import tqdm -import time def apply(config: dict) -> bool: - time.sleep(0.2) return False diff --git a/patches/change_server.py b/patches/todo_change_server.py similarity index 99% rename from patches/change_server.py rename to patches/todo_change_server.py index 2105ce9..8b6aef3 100644 --- a/patches/change_server.py +++ b/patches/todo_change_server.py @@ -5,6 +5,7 @@ from tqdm import tqdm import json import requests + def apply(config: dict) -> bool: response = requests.get(config['server']) if response.status_code == 200: diff --git a/patches/custom_speed.py b/patches/todo_custom_speed.py similarity index 90% rename from patches/custom_speed.py rename to patches/todo_custom_speed.py index cadc629..c245860 100644 --- a/patches/custom_speed.py +++ b/patches/todo_custom_speed.py @@ -1,7 +1,5 @@ """Change application icon""" - priority = 0 -from tqdm import tqdm import struct