57 lines
2.0 KiB
Python
57 lines
2.0 KiB
Python
"""Добавляет всплывающее окно при первом входе
|
||
|
||
"welcome": {
|
||
"enabled": true,
|
||
"title": "Anixarty",
|
||
"description": "Описание",
|
||
"link_text": "МЫ В TELEGRAM",
|
||
"link_url": "https://t.me/http_teapod",
|
||
"skip_text": "Пропустить",
|
||
"title_bg_color": "#FFFFFF"
|
||
}
|
||
"""
|
||
|
||
priority = 0
|
||
|
||
# imports
|
||
import os
|
||
import shutil
|
||
from pydantic import Field
|
||
from typing import Dict, Any
|
||
from utils.config import PatchConfig
|
||
from utils.smali_parser import (
|
||
find_and_replace_smali_line,
|
||
get_smali_lines,
|
||
save_smali_lines
|
||
)
|
||
|
||
#Config
|
||
class Config(PatchConfig):
|
||
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="Цвет фона заголовка")
|
||
|
||
|
||
# Patch
|
||
def apply(config: Config, base: Dict[str, Any]) -> bool:
|
||
# Добавление ресурсов окна первого входа
|
||
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/"
|
||
)
|
||
|
||
file_path = "./decompiled/smali_classes2/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(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
|