package com.composition.android.ad.gromore.impl

import android.content.Context
import com.bytedance.sdk.openadsdk.TTAdConfig
import com.bytedance.sdk.openadsdk.TTAdSdk
import com.composition.android.lib.ad.AdManager
import com.composition.android.lib.ad.interfaces.Initialize
import com.composition.android.lib.ad.util.adLogE

/**
 * @classname:
 * @author: LiuXiaoLong
 * @date: 2022/9/15
 * description:GroMore SDK初始化
 */
class GroMoreInitialize(var appId: String) : Initialize {

    override fun init(context: Context) {
        TTAdSdk.init(context, TTAdConfig.Builder()
            .appId(appId)
            .useTextureView(true)
            .appName(context.packageName)
            .supportMultiProcess(true)
            .debug(AdManager.instance.isDebug)
            .useMediation(true)
            .build(), object : TTAdSdk.InitCallback {
            override fun success() {
                TTAdSdk.isInitSuccess()
                adLogE(AdManager.TAG, "GroMoreSDK初始化完成 ---- 版本号:${TTAdSdk.getAdManager().sdkVersion}")
            }

            override fun fail(p0: Int, p1: String?) {
                adLogE(AdManager.TAG, "GroMoreSDK初始化失败")
            }
        })
    }
}