56 lines
2.2 KiB
Python
56 lines
2.2 KiB
Python
"""Добавляет всплывающее окно при первом входе
|
||
|
||
"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
|