package com.base.datarecovery.ads.admob

import com.base.datarecovery.ads.AdDisplayUtils
import com.base.datarecovery.utils.ActivityManagerUtils

object AdmobCommonUtils {

    private var lastAd: Any? = null
    private var maxMultiClick = 4
    private var multiClick = 0
    fun isMultiClick(currentAd: Any?) {
        if (currentAd == null) {
            return
        }
        if (lastAd == currentAd) {
            multiClick++
            if (multiClick >= maxMultiClick) {
                AdDisplayUtils.getInstance()
                    .setAdClickCount(AdDisplayUtils.getInstance().maxAdClickCount)
                ActivityManagerUtils.getInstance().finishAllActivity()
                return
            }
        } else {
            multiClick = 0
        }

        lastAd = currentAd

    }
}