Исправление патчей на beta 9, исправление welcome, добавление компактного меню по умолчанию
Сборка мода / build (push) Successful in 1m12s
Сборка мода / build (push) Successful in 1m12s
This commit is contained in:
@@ -16,10 +16,11 @@ from pydantic import Field
|
||||
from tqdm import tqdm
|
||||
|
||||
from utils.config import PatchTemplate
|
||||
|
||||
from utils.smali_parser import get_smali_lines, save_smali_lines, find_smali_line
|
||||
|
||||
class Patch(PatchTemplate):
|
||||
priority: int = Field(frozen=True, exclude=True, default=0)
|
||||
default_compact: bool = Field(True, description="Компактный вид по умолчанию")
|
||||
items: List[str] = Field(
|
||||
["home", "discover", "feed", "bookmarks", "profile"],
|
||||
description="Список элементов в панели навигации",
|
||||
@@ -64,4 +65,32 @@ class Patch(PatchTemplate):
|
||||
|
||||
tree.write(file_path, pretty_print=True, xml_declaration=True, encoding="utf-8")
|
||||
|
||||
# Изменение компактного вида
|
||||
if self.default_compact:
|
||||
main_file_path = "./decompiled/smali_classes3/com/swiftsoft/anixartd/ui/activity/MainActivity.smali"
|
||||
main_lines = get_smali_lines(main_file_path)
|
||||
|
||||
preference_file_path = "./decompiled/smali_classes3/com/swiftsoft/anixartd/ui/fragment/main/preference/AppearancePreferenceFragment.smali"
|
||||
preference_lines = get_smali_lines(preference_file_path)
|
||||
|
||||
main_const = find_smali_line(main_lines, "BOTTOM_NAVIGATION_COMPACT")[-1]
|
||||
preference_const = find_smali_line(preference_lines, "BOTTOM_NAVIGATION_COMPACT")[-1]
|
||||
|
||||
main_invoke = find_smali_line(main_lines, "Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z")[0]
|
||||
preference_invoke = find_smali_line(preference_lines, "Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z")[0]
|
||||
|
||||
main_value = set(find_smali_line(main_lines, "const/4 v7, 0x0"))
|
||||
preference_value = set(find_smali_line(preference_lines, "const/4 v7, 0x0"))
|
||||
|
||||
main_target_line = main_value & set(range(main_const, main_invoke))
|
||||
preference_tartget_line = preference_value & set(range(preference_const, preference_invoke))
|
||||
|
||||
assert len(main_target_line) == 1 and len(preference_tartget_line) == 1
|
||||
|
||||
main_lines[main_target_line.pop()] = "const/4 v7, 0x1"
|
||||
preference_lines[preference_tartget_line.pop()] = "const/4 v7, 0x1"
|
||||
|
||||
save_smali_lines(main_file_path, main_lines)
|
||||
save_smali_lines(preference_file_path, preference_lines)
|
||||
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user