"""
Вставляет новые файлы в проект
"""
priority = 0

import shutil
import os

from utils.public import insert_after_public


def apply(config: dict) -> bool:
    # Mod first launch window
    shutil.copytree(
        "./patches/resources/smali_classes4/", "./decompiled/smali_classes4/"
    )

    # Mod assets
    shutil.copy("./patches/resources/avatar.png", "./decompiled/assets/avatar.png")
    shutil.copy(
        "./patches/resources/OpenSans-Regular.ttf",
        "./decompiled/assets/OpenSans-Regular.ttf",
    )
    shutil.copy(
        "./patches/resources/ic_custom_crown.xml",
        "./decompiled/res/drawable/ic_custom_crown.xml",
    )
    shutil.copy(
        "./patches/resources/ic_custom_telegram.xml",
        "./decompiled/res/drawable/ic_custom_telegram.xml",
    )
    shutil.copy(
        "./patches/resources/ytsans_medium.ttf",
        "./decompiled/res/font/ytsans_medium.ttf",
    )
    os.remove("./decompiled/res/font/ytsans_medium.otf")

    insert_after_public("warning_error_counter_background", "ic_custom_telegram")
    insert_after_public("warning_error_counter_background", "ic_custom_crown")

    return True
