Исправление патчей на beta 9, исправление welcome, добавление компактного меню по умолчанию
Сборка мода / build (push) Successful in 1m12s
Сборка мода / build (push) Successful in 1m12s
This commit is contained in:
@@ -21,7 +21,7 @@ class Patch(PatchTemplate):
|
||||
priority: int = Field(frozen=True, exclude=True, default=0)
|
||||
|
||||
def apply(self, base: Dict[str, Any]) -> bool:
|
||||
path = "./decompiled/smali_classes2/com/swiftsoft/anixartd/Prefs.smali"
|
||||
path = "./decompiled/smali_classes3/com/swiftsoft/anixartd/Prefs.smali"
|
||||
replacement = [
|
||||
f"\t{line}\n"
|
||||
for line in textwrap.dedent(
|
||||
|
||||
@@ -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
|
||||
|
||||
+10
-10
@@ -34,6 +34,13 @@ from utils.public import insert_after_public
|
||||
# Config
|
||||
DEFAULT_MENU = {
|
||||
"Мы в социальных сетях": [
|
||||
{
|
||||
"title": "Мы в Telegram",
|
||||
"description": "Подпишитесь на канал, чтобы быть в курсе последних новостей.",
|
||||
"url": "https://t.me/http_teapod",
|
||||
"icon": "@drawable/ic_custom_telegram",
|
||||
"icon_space_reserved": "false",
|
||||
},
|
||||
{
|
||||
"title": "wowlikon",
|
||||
"description": "Разработчик",
|
||||
@@ -48,19 +55,12 @@ DEFAULT_MENU = {
|
||||
"icon": "@drawable/ic_custom_telegram",
|
||||
"icon_space_reserved": "false",
|
||||
},
|
||||
{
|
||||
"title": "Мы в Telegram",
|
||||
"description": "Подпишитесь на канал, чтобы быть в курсе последних новостей.",
|
||||
"url": "https://t.me/http_teapod",
|
||||
"icon": "@drawable/ic_custom_telegram",
|
||||
"icon_space_reserved": "false",
|
||||
},
|
||||
],
|
||||
"Прочее": [
|
||||
{
|
||||
"title": "Помочь проекту",
|
||||
"description": "Вы можете помочь нам с идеями, написанием кода или тестированием.",
|
||||
"url": "https://git.wowlikon.tech/anixart-mod",
|
||||
"url": "https://git.0x174.su/anixart-mod",
|
||||
"icon": "@drawable/ic_custom_crown",
|
||||
"icon_space_reserved": "false",
|
||||
}
|
||||
@@ -122,8 +122,8 @@ class Patch(PatchTemplate):
|
||||
|
||||
# Добавление суффикса версии
|
||||
filepaths = [
|
||||
"./decompiled/smali_classes2/com/swiftsoft/anixartd/ui/activity/UpdateActivity.smali",
|
||||
"./decompiled/smali_classes2/com/swiftsoft/anixartd/ui/fragment/main/preference/MainPreferenceFragment.smali",
|
||||
"./decompiled/smali_classes3/com/swiftsoft/anixartd/ui/activity/UpdateActivity.smali",
|
||||
"./decompiled/smali_classes3/com/swiftsoft/anixartd/ui/fragment/main/preference/MainPreferenceFragment.smali",
|
||||
]
|
||||
for filepath in filepaths:
|
||||
content = ""
|
||||
|
||||
+47
-4
@@ -15,6 +15,7 @@ __author__ = "wowlikon <wowlikon@gmail.com>"
|
||||
__version__ = "1.0.0"
|
||||
import shutil
|
||||
from typing import Any, Dict
|
||||
from urllib import parse
|
||||
|
||||
from pydantic import Field
|
||||
|
||||
@@ -25,23 +26,38 @@ from utils.smali_parser import (find_and_replace_smali_line, get_smali_lines,
|
||||
|
||||
class Patch(PatchTemplate):
|
||||
priority: int = Field(frozen=True, exclude=True, default=0)
|
||||
|
||||
title: str = Field("Anixarty", description="Заголовок")
|
||||
title_color: str = Field("#FF252525", description="Цвет заголовка")
|
||||
|
||||
title_bg_color: str = Field("#FFCFF04D", description="Цвет фона заголовка")
|
||||
body_bg_color: str = Field("#FF252525", description="Цвет фона окна")
|
||||
|
||||
description: str = Field("Описание", description="Описание")
|
||||
description_color: str = Field("#FFFFFFFF", description="Цвет описания")
|
||||
|
||||
skip_text: str = Field("Пропустить", description="Текст кнопки пропустить")
|
||||
skip_color: str = Field("#FFFFFFFF", description="Цвет кнопки пропустить")
|
||||
|
||||
link_text: str = Field("МЫ В TELEGRAM", description="Текст ссылки")
|
||||
link_color: str = Field("#FFCFF04D", description="Цвет ссылки")
|
||||
link_url: str = Field("https://t.me/http_teapod", description="Ссылка")
|
||||
skip_text: str = Field("Пропустить", description="Текст кнопки пропуска")
|
||||
title_bg_color: str = Field("#FFFFFF", description="Цвет фона заголовка")
|
||||
|
||||
def encode_text(self, text: str) -> str:
|
||||
return '+'.join([parse.quote(i) for i in text.split(' ')])
|
||||
|
||||
def apply(self, base: Dict[str, Any]) -> bool:
|
||||
file_path = "./decompiled/smali_classes2/com/swiftsoft/anixartd/ui/activity/MainActivity.smali"
|
||||
# Добавление ресурсов окна первого входа
|
||||
shutil.copy("./resources/avatar.png", "./decompiled/assets/avatar.png")
|
||||
shutil.copy(
|
||||
"./resources/OpenSans-Regular.ttf",
|
||||
"./decompiled/assets/OpenSans-Regular.ttf",
|
||||
)
|
||||
shutil.copytree("./resources/smali_classes4/", "./decompiled/smali_classes4/")
|
||||
for subdir in ["about/", "authorization/"]:
|
||||
shutil.copytree("./resources/smali_classes4/com/swiftsoft/"+subdir, "./decompiled/smali_classes4/com/swiftsoft/"+subdir)
|
||||
|
||||
# Привязка к первому запуску
|
||||
file_path = "./decompiled/smali_classes3/com/swiftsoft/anixartd/ui/activity/MainActivity.smali"
|
||||
method = "invoke-super {p0}, Lmoxy/MvpAppCompatActivity;->onResume()V"
|
||||
lines = get_smali_lines(file_path)
|
||||
lines = find_and_replace_smali_line(
|
||||
@@ -52,4 +68,31 @@ class Patch(PatchTemplate):
|
||||
)
|
||||
save_smali_lines(file_path, lines)
|
||||
|
||||
# Замена ссылки
|
||||
file_path = "./decompiled/smali_classes4/com/swiftsoft/about/$4.smali"
|
||||
lines = get_smali_lines(file_path)
|
||||
lines = find_and_replace_smali_line(
|
||||
lines,
|
||||
"const-string v0, \"https://example.com\"",
|
||||
'const-string v0, "' + self.link_url + '"',
|
||||
)
|
||||
save_smali_lines(file_path, lines)
|
||||
|
||||
# Настройка всплывающго окна
|
||||
file_path = "./decompiled/smali_classes4/com/swiftsoft/about/$2.smali"
|
||||
lines = get_smali_lines(file_path)
|
||||
for replacement in [
|
||||
('const-string v5, "#FF252525" # Title color', f'const-string v5, "{self.title_color}"'),
|
||||
('const-string v7, "#FFFFFFFF" # Description color', f'const-string v7, "{self.description_color}"'),
|
||||
('const-string v8, "#FFCFF04D" # Link color', f'const-string v8, "{self.link_color}"'),
|
||||
('const-string v9, "#FFFFFFFF" # Skip color', f'const-string v9, "{self.skip_color}"'),
|
||||
('const-string v5, "#FF252525" # Body background', f'const-string v5, "{self.body_bg_color}"'),
|
||||
('const-string v10, "#FFCFF04D" # Title background', f'const-string v10, "{self.title_bg_color}"'),
|
||||
('const-string v12, "Title"', f'const-string v12, "{self.encode_text(self.title)}"'),
|
||||
('const-string v11, "Description"', f'const-string v11, "{self.encode_text(self.description)}"'),
|
||||
('const-string v12, "URL"', f'const-string v12, "{self.link_text.encode('unicode-escape').decode()}"'),
|
||||
('const-string v12, "Skip"', f'const-string v12, "{self.skip_text.encode('unicode-escape').decode()}"')
|
||||
]: lines = find_and_replace_smali_line(lines, *replacement)
|
||||
save_smali_lines(file_path, lines)
|
||||
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user