package com.phlx.wool;


import com.uhf.linkage.Linkage;

import me.goldze.mvvmhabit.base.BaseApplication;
import me.goldze.mvvmhabit.crash.CaocConfig;
import me.goldze.mvvmhabit.utils.KLog;


public class App extends BaseApplication {
    private Linkage link;
    private static App instance;



    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;
        //是否开启打印日志
        KLog.init(true);
        //初始化全局异常崩溃
        initCrash();
        link = new Linkage();
        link.initRFID();
    }

    public static App getInstance() {
        return instance;
    }


    private void initCrash() {
        CaocConfig.Builder.create()
                .backgroundMode(CaocConfig.BACKGROUND_MODE_SILENT) //背景模式,开启沉浸式
                .enabled(true) //是否启动全局异常捕获
                .showErrorDetails(true) //是否显示错误详细信息
                .showRestartButton(true) //是否显示重启按钮
                .trackActivities(true) //是否跟踪Activity
                .minTimeBetweenCrashesMs(2000) //崩溃的间隔时间(毫秒)
                .errorDrawable(R.mipmap.ic_launcher) //错误图标
                .apply();
    }







    public  Linkage getLinkage() {
        if (link == null) {
            link = new Linkage();
            link.initRFID();
        }

        return link;
    }
}
