package com.keyboard.theme.app.keyboard

import android.app.Application
import android.graphics.Typeface
import android.util.Log
import com.google.firebase.FirebaseApp
import com.keyboard.theme.app.keyboard.data.Info
import com.keyboard.theme.app.keyboard.utils.FileManager

class MyAppllication : Application() {

    override fun onCreate() {
        super.onCreate()
        instance = this

        FileManager.getFileStr(assets.open("data.json")) {
            if (it != null) {
                requireNotNull(it.isNotEmpty())
                data = FileManager.getDataBean(it)
            }
        }
        font = Typeface.createFromAsset(assets,"myfont.ttf")
        if (FirebaseApp.getApps(this).isNotEmpty()) {
//            Log.d("TAG", "Firebase 初始化成功");
        } else {
//            Log.e("TAG", "Firebase 初始化失败");
        }


    }

    companion object {
        var data: List<Info> = mutableListOf()
        lateinit var instance: MyAppllication

        lateinit var font:Typeface
    }
}