Files
patcher/patches/welcome.py
2025-12-28 17:47:56 +03:00

56 lines
2.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Добавляет всплывающее окно при первом входе
"welcome": {
"enabled": true,
"title": "Anixarty",
"description": "Описание",
"link_text": "МЫ В TELEGRAM",
"link_url": "https://t.me/http_teapod",
"skip_text": "Пропустить",
"title_bg_color": "#FFFFFF"
}
"""
__author__ = "wowlikon <wowlikon@gmail.com>"
__version__ = "1.0.0"
import shutil
from typing import Any, Dict
from pydantic import Field
from utils.config import PatchTemplate
from utils.smali_parser import (find_and_replace_smali_line, get_smali_lines,
save_smali_lines)
class Patch(PatchTemplate):
priority: int = Field(frozen=True, exclude=True, default=0)
title: str = Field("Anixarty", description="Заголовок")
description: str = Field("Описание", description="Описание")
link_text: str = Field("МЫ В TELEGRAM", description="Текст ссылки")
link_url: str = Field("https://t.me/http_teapod", description="Ссылка")
skip_text: str = Field("Пропустить", description="Текст кнопки пропуска")
title_bg_color: str = Field("#FFFFFF", description="Цвет фона заголовка")
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/")
method = "invoke-super {p0}, Lmoxy/MvpAppCompatActivity;->onResume()V"
lines = get_smali_lines(file_path)
lines = find_and_replace_smali_line(
lines,
method,
method
+ "\ninvoke-static {p0}, Lcom/swiftsoft/about/$2;->oooooo(Landroid/content/Context;)Ljava/lang/Object;",
)
save_smali_lines(file_path, lines)
return True