package com.danding.yang800.General;

import android.app.Application;
import android.content.Context;

import com.qiyukf.unicorn.api.SavePowerConfig;
import com.qiyukf.unicorn.api.StatusBarNotificationConfig;
import com.qiyukf.unicorn.api.Unicorn;
import com.qiyukf.unicorn.api.YSFOptions;
import com.tencent.bugly.crashreport.CrashReport;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import com.umeng.commonsdk.UMConfigure;
import com.umeng.socialize.PlatformConfig;
import com.umeng.socialize.UMShareAPI;


/**
 * Created by Administrator on 2017/7/3.
 */
public class Yang800App extends Application {
    public static boolean wifiConnect = true;//一开始准备加上网络监听，此参数昨晚标识，目前暂时没用
    public static boolean iflogin = true;//是否登录
    public static IWXAPI api;
    private static Yang800App mInstance;

    @Override
    public void onCreate() {
        super.onCreate();
        UMShareAPI.get(this);
        mInstance = this;
//        CrashReport.initCrashReport(getApplicationContext(), "9c972d43bd", true);//bugly配置
//        CrashReport.initCrashReport(getApplicationContext(), "e75289ed06", true);//bugly配置
        Unicorn.init(this, "d19214f810eb3e403ae9491bdbfb9e3b", options(), new GlideImageLoader(this));//七鱼配置
        UMConfigure.init(getApplicationContext(), UMConfigure.DEVICE_TYPE_PHONE, null);
    }

    {
        PlatformConfig.setWeixin("wx8cba515fdff29f38", "cac3ebd1b04ca04c98aeea0b1529bb3b");//友盟分享配置
    }

    private YSFOptions options() {
        YSFOptions options = new YSFOptions();
        options.statusBarNotificationConfig = new StatusBarNotificationConfig();
        // options.uiCustomization=new UICustomization();
        // options.uiCustomization.rightAvatar="https://gss0.bdstatic.com/-4o3dSag_xI4khGkpoWK1HF6hhy/baike/w%3D268%3Bg%3D0/sign=35ac0a83c6cec3fd8b3ea073eeb3b302/6159252dd42a2834b825c1445eb5c9ea14cebffa.jpg";
        options.savePowerConfig = new SavePowerConfig();
        return options;
    }

    public static IWXAPI getApi(Context context) {
        if (api == null) {
            api = WXAPIFactory.createWXAPI(context.getApplicationContext(), "wx8cba515fdff29f38",
                    true);
            api.registerApp("wx8cba515fdff29f38");
            return api;
        }
        return api;
    }

    public static Application getInstance() {
        return mInstance;
    }
}
