package com.gh.gamecenter

import android.app.Activity
import android.content.Context
import android.text.TextUtils
import com.bytedance.applog.AppLog
import com.bytedance.applog.GameReportHelper
import com.bytedance.applog.InitConfig
import com.bytedance.applog.util.UriConstants

import com.gh.gamecenter.common.exposure.meta.MetaUtil
import com.halo.assistant.HaloApp
import com.lightgame.utils.Utils

/**
* 5.3.0 版本的 SDK
**/
object TeaHelper {

    @JvmStatic
    fun init(context: Context, activity: Activity, channel: String) {
        val config = InitConfig("163824", channel)
        config.setUriConfig(UriConstants.DEFAULT)
        config.appName = "guanghuan1"
        config.setEnablePlay(true)
        config.setAutoStart(true)
        AppLog.init(context, config)

        AppLog.setOaidObserver {
            if (!TextUtils.isEmpty(it.id)) {
                HaloApp.getInstance().oaid = it.id
                MetaUtil.refreshMeta()
            }
            Utils.log("oaid is $it.id")
        }

        // gameReportHelper ?!
        GameReportHelper.onEventRegister("wechat", true)
        GameReportHelper.onEventPurchase("gift", "flower", "008", 1, "wechat", "¥", true, 1)
        Utils.log("init TeaHelper")
    }

    @JvmStatic
    fun onEvent(type: String) {
        AppLog.onEventV3(type)
    }

}