package com.atmob.voiceai;

import android.content.Context;

import com.atmob.app.lib.base.BaseApplication;
import com.atmob.user.AtmobUser;
import com.atmob.voiceai.sdk.billing.GPBillingClient;
import com.atmob.voiceai.utils.ToastUtil;

import java.util.Objects;

import javax.inject.Inject;

import dagger.hilt.android.HiltAndroidApp;


@HiltAndroidApp
public class App extends BaseApplication {


    @Inject
    GPBillingClient gpBillingClient;

    private static App INSTANCE;

    public static App getInstance() {
        return INSTANCE;
    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        INSTANCE = this;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        checkServerRuntime();
    }

    private void checkServerRuntime() {
        if (BuildConfig.DEBUG) {
            return;
        }
        if (!Objects.equals(BuildConfig.ENV, BuildConfig.PROD)) {
            ToastUtil.show("当前环境不是正式环境!", ToastUtil.LENGTH_LONG);
        }
    }

    @Override
    protected boolean isDebug() {
        return BuildConfig.DEBUG;
    }

    @Override
    protected String defaultChannel() {
        return "GooglePlay";
    }

    @Override
    protected int defaultAppId() {
        return 0;
    }

    @Override
    protected int defaultTgPlatformId() {
        return 0;
    }

    @Override
    protected int complianceStrategy() {
        return AtmobUser.GLOBAL;
    }

    @Override
    protected void initCommon(boolean b) {

    }

    @Override
    public void initAfterGrant(boolean b) {

    }
}
