package com.quansu.heifengwuliu;

import com.litesuits.orm.LiteOrm;
import com.quansu.heifengwuliu.config.Config;
import com.quansu.heifengwuliu.utils.WeChatUtil;
import com.ysnows.base.base.BApp;
import com.ysnows.base.ccretrofit.CCRetrofit;
import com.ysnows.base.config.IConfig;
import com.ysnows.base.route.IUpdate;
import com.ysnows.base.route.IJpush;

public class App extends BApp  {

    private static App app = null;
    public static LiteOrm configOrm;

    private IConfig config;


    @Override
    protected void init() {
        app = this;
        CCRetrofit.instance()
                .create(IUpdate.class)
                .init()
                .subscribe();

        //一键登录
        CCRetrofit.instance()
                .with(this)
                .create(IJpush.class)
                .init()
                .subscribe();

        //注册微信
        WeChatUtil.Companion.regToWx(this);

//        CCRetrofit.instance()
//                .create(IUmeng.class)
//                .init()
//                .subscribe();

    }

    public static App getApp() {
        return app;
    }

    public static LiteOrm getLiteOrm() {
        return liteOrm;
    }


    public static LiteOrm getConfigOrm() {
        return configOrm;
    }

    public static void setConfigOrm(LiteOrm configOrm) {
        App.configOrm = configOrm;
    }

    @Override
    public IConfig config() {
        if (config == null) {
            config = new Config();
        }
        return config;
    }
}
