package com.duben.microtribe.ad

import android.app.Activity
import com.duben.microtribe.ad.splash.SplashManager
import com.duben.microtribe.ad.video.InMoneyVideo
import com.duben.microtribe.manager.UserManager

/**
 * 预加载-全屏及激励视频管理类
 */
class AdManager {

    companion object {

        const val AD_NO_SHOWTIME_OUT = 50 // 广告请示成功但在规定时间内未展示
        const val AD_REQUEST_TIME_OUT = 1 // 广告预加载时长超时

        val instance: AdManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
            AdManager()
        }
    }

    /**
     * 根据服务器概率预加载广告
     *
     * isPreLoad:是否是预加载调用，需要躲避监听
     */
    fun preLoadAd(activity: Activity, isPreLoad: Boolean = false) {
        InMoneyVideo.getInstance().preLoadAd(activity, isPreLoad)
    }

    /**
     * 根据预加载类型 展示广告
     */
    fun showAd(
        activity: Activity,
        carrierType: String,
        AdStatusListener: AdStatusListener?,
    ) {
        InMoneyVideo.getInstance()
            .showRewardAd(
                activity,
                AdStatusListener,
                carrierType,
            )
    }
}