package com.base.appzxhy.drouterimp

import android.app.Activity
import com.base.appzxhy.ads.AdsMgr
import com.base.appzxhy.ads.AdsShowCallBack
import com.base.appzxhy.bean.config.AdConfigBean
import com.didi.drouter.annotation.Service
import com.koko.drouter.ad.InterAdService

@Service(function = [InterAdService::class])
class InterAdServiceImp : InterAdService {

    override fun showInterAd(activity: Activity, interWhere: String, callBack: () -> Unit) {


        if (AdConfigBean.adsConfigBean.functionInShowAd) {
            AdsMgr.showInsert(activity, object : AdsShowCallBack() {
                override fun next() {
                    callBack.invoke()
                }

            })
        } else {
            callBack.invoke()
        }

    }

    override fun showInterAdBack(activity: Activity, interWhere: String, callBack: () -> Unit) {

        if (AdConfigBean.adsConfigBean.functionBackShowAd) {
            AdsMgr.showInsert(activity, object : AdsShowCallBack() {
                override fun next() {
                    callBack.invoke()
                }
            })
        } else {
            callBack.invoke()
        }
    }

}