"""Insert new files"""

priority = 0
from tqdm import tqdm

import shutil
import os


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")

    # IDK
    shutil.move(
        "./decompiled/res/raw/bundled_cert.crt",
        "./decompiled/res/raw/bundled_cert.cer",
    )
    shutil.move(
        "./decompiled/res/raw/sdkinternalca.crt",
        "./decompiled/res/raw/sdkinternalca.cer",
    )

    return True
