package com.keyboard.journey

import android.app.Application
import android.util.Log
import com.anythink.core.api.ATSDK
import com.anythink.core.api.NetTrafficeCallback
//import com.anythink.debug.api.ATDebuggerUITest
import com.keyboard.journey.topon.AdManager

class JourneyApp : Application() {
    companion object {
        lateinit var app: JourneyApp
        const val TAG = "----------"
    }
    private val APPId="h6697811556e91"
    private val APPKey="44f890794fdaec43c4df6cc60e345eb2"
    private val debug_key="529b9d845e53ac839536d321c0b6be5f6928b24d"
    override fun onCreate() {
        super.onCreate()
        app = this
        initSDK()
    }

    private fun initSDK() {
        ATSDK.checkIsEuTraffic(this, object : NetTrafficeCallback {
            override fun onResultCallback(isEU: Boolean) {
                Log.e(TAG, "onResultCallback:$isEU")
                if (isEU && ATSDK.getGDPRDataLevel(this@JourneyApp) == ATSDK.UNKNOWN) {
                    ATSDK.showGdprAuth(this@JourneyApp)
                }
            }

            override fun onErrorCallback(p0: String?) {
                Log.e(TAG, "onErrorCallback:${p0}")
            }

        })


        ATSDK.init( this, APPId, APPKey)
        AdManager.loadAllAd()
        //测试工具
//        ATDebuggerUITest.showDebuggerUI(this,debug_key)
    }
}