Commit eacf3173 authored by wanglei's avatar wanglei

...

parent 4bcf42c8
package com.base.pdfviewerscannerwhite.ads;
package com.base.pdfviewerscannerwhite.ads
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;
import com.base.pdfviewerscannerwhite.ads.FirebaseDatabase.inter_limit_click
import com.base.pdfviewerscannerwhite.ads.FirebaseDatabase.inter_limit_request
import com.base.pdfviewerscannerwhite.ads.FirebaseDatabase.inter_limit_show
import com.base.pdfviewerscannerwhite.ads.FirebaseDatabase.native_limit_request
import com.base.pdfviewerscannerwhite.ads.FirebaseDatabase.native_limit_show
import com.base.pdfviewerscannerwhite.ads.FirebaseDatabase.open_limit_click
import com.base.pdfviewerscannerwhite.ads.FirebaseDatabase.open_limit_request
import com.base.pdfviewerscannerwhite.ads.FirebaseDatabase.open_limit_show
import com.base.pdfviewerscannerwhite.helper.EventUtils
import com.base.pdfviewerscannerwhite.utils.AppPreferences
import com.base.pdfviewerscannerwhite.utils.LogEx
import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.Locale
import org.json.JSONException;
import org.json.JSONObject;
object AdDisplayUtils {
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import com.base.pdfviewerscannerwhite.BuildConfig;
import com.base.pdfviewerscannerwhite.helper.EventUtils;
import com.base.pdfviewerscannerwhite.helper.MyApplication;
import com.base.pdfviewerscannerwhite.utils.AppPreferences;
import com.base.pdfviewerscannerwhite.utils.LogEx;
import com.facebook.appevents.AppEventsLogger;
public class AdDisplayUtils {
private String TAG = "AdDisplayUtils";
public static final int DEFAULT_MAX_AD_REQUEST_COUNT = 100; // 广告请求次数限制默认值
public static final int DEFAULT_MAX_AD_REQUEST_FAIL_COUNT = 20; // 单个广告点击次数限制默认值
public static final int DEFAULT_MAX_AD_DISPLAY_COUNT = 45; // 总广告展示次数限制默认值
public static final int DEFAULT_MAX_AD_CLICK_COUNT = 10; // 单个广告点击次数限制默认值
private static final String AD_PREFS_NAME = "ad_prefs"; // SharedPreferences 名称
private static AdDisplayUtils instance; // 单例对象
private String currentDate; // 当前日期
private Context context = MyApplication.context;
public void saveSp() {
this.maxAdRequestCount = Integer.parseInt(AppPreferences.getInstance().getString("adMaxRequestCount", String.valueOf(DEFAULT_MAX_AD_REQUEST_COUNT)));
saveMaxAdRequestCount();
this.maxAdRequestFailCount = Integer.parseInt(AppPreferences.getInstance().getString("adRequestFailCount", String.valueOf(DEFAULT_MAX_AD_REQUEST_FAIL_COUNT)));
saveMaxAdRequestFailCount();
this.maxAdDisplayCount = Integer.parseInt(AppPreferences.getInstance().getString("adShowCount", String.valueOf(DEFAULT_MAX_AD_DISPLAY_COUNT)));
saveMaxAdDisplayCount();
this.maxAdClickCount = Integer.parseInt(AppPreferences.getInstance().getString("adClickCount", String.valueOf(DEFAULT_MAX_AD_CLICK_COUNT)));
saveMaxAdClickCount();
//region open
private val open_max_request = AppPreferences.getInstance().getString(open_limit_request, "15").toInt()
private val open_max_show = AppPreferences.getInstance().getString(open_limit_show, "10").toInt()
private val open_max_click = AppPreferences.getInstance().getString(open_limit_click, "1").toInt()
fun incrementOpenRequestCount() {
currentOpenRequest += 1
}
private AdDisplayUtils() {
currentDate = getCurrentDate();
SharedPreferences prefs = context.getSharedPreferences(AD_PREFS_NAME, 0);
maxAdRequestCount = prefs.getInt(MAX_AD_REQUEST_COUNT_KEY, DEFAULT_MAX_AD_REQUEST_COUNT);
maxAdRequestFailCount = prefs.getInt(MAX_AD_REQUEST_FAIL_COUNT_KEY, DEFAULT_MAX_AD_REQUEST_FAIL_COUNT);
maxAdDisplayCount = prefs.getInt(MAX_AD_DISPLAY_COUNT_KEY, DEFAULT_MAX_AD_DISPLAY_COUNT);
maxAdClickCount = prefs.getInt(MAX_AD_CLICK_COUNT_KEY, DEFAULT_MAX_AD_CLICK_COUNT);
adRequestCount = prefs.getInt(getAdRequestCountKey(), 0);
adRequestFailCount = prefs.getInt(getAdRequestFailCountKey(), 0);
adDisplayCount = prefs.getInt(getAdDisplayCountKey(), 0);
adClickCount = prefs.getInt(getAdClickCountKey(), 0);
fun incrementOpenShow() {
currentOpenShow += 1
}
public static synchronized AdDisplayUtils getInstance() {
if (instance == null) {
instance = new AdDisplayUtils();
}
return instance;
fun incrementClickShow() {
currentOpenClick += 1
}
public boolean shouldSendAdRequest() {
return adRequestCount < maxAdRequestCount;
}
public boolean shouldIncrementRequestFailAd() {
return adRequestFailCount < maxAdRequestFailCount;
//当前开屏请求次数
private var currentOpenRequest = 0
get() {
return AppPreferences.getInstance().getInt("currentOpenRequest_${currentDate()}", field)
}
public boolean shouldDisplayAd() {
return adDisplayCount < maxAdDisplayCount;
set(value) {
field = value
AppPreferences.getInstance().put("currentOpenRequest_${currentDate()}", value, true)
}
public boolean shouldIncrementClickCount() {
return adClickCount < maxAdClickCount;
//当前开屏展示次数
private var currentOpenShow = 0
get() {
return AppPreferences.getInstance().getInt("currentOpenShow_${currentDate()}", field)
}
public boolean shouldShowAd(String ad_unit) {
if (BuildConfig.DEBUG) {
return true;
set(value) {
field = value
AppPreferences.getInstance().put("currentOpenShow_${currentDate()}", value, true)
}
boolean shouldDisplayAd = shouldDisplayAd();
boolean shouldIncrementClickCount = shouldIncrementClickCount();
boolean shouldIncrementRequestFailAd = shouldIncrementRequestFailAd();
boolean shouldSendAdRequest = shouldSendAdRequest();
LogEx.INSTANCE.logDebug(TAG, "shouldSendAdRequest=" + shouldSendAdRequest, false);
LogEx.INSTANCE.logDebug(TAG, "shouldIncrementRequestFailAd=" + shouldIncrementRequestFailAd, false);
LogEx.INSTANCE.logDebug(TAG, "shouldIncrementClickCount=" + shouldIncrementClickCount, false);
LogEx.INSTANCE.logDebug(TAG, "shouldDisplayAd=" + shouldDisplayAd, false);
boolean show = shouldIncrementRequestFailAd && shouldSendAdRequest && shouldDisplayAd && shouldIncrementClickCount;
if (!show) {
LogEx.INSTANCE.logDebug("glc", "!shouldShowAd", false);
JSONObject obj2 = new JSONObject();
try {
obj2.put("reason", "ad_limit");
obj2.put("shouldSendAdRequest", shouldSendAdRequest);
obj2.put("shouldIncrementRequestFailAd", shouldIncrementRequestFailAd);
obj2.put("shouldDisplayAd", shouldDisplayAd);
obj2.put("shouldIncrementClickCount", shouldIncrementClickCount);
obj2.put("adDisplayCount", adDisplayCount);
obj2.put("maxAdDisplayCount", maxAdDisplayCount);
obj2.put("adClickCount", adClickCount);
obj2.put("maxAdClickCount", maxAdClickCount);
obj2.put("adRequestFailCount", adRequestFailCount);
obj2.put("adRequestCount", maxAdRequestFailCount);
obj2.put("adRequestCount", adRequestCount);
//当前开屏点击次数
private var currentOpenClick = 0
get() {
return AppPreferences.getInstance().getInt("currentOpenClick_${currentDate()}", field)
}
set(value) {
field = value
AppPreferences.getInstance().put("currentOpenClick_${currentDate()}", value, true)
}
obj2.put("ad_unit", ad_unit);
EventUtils.INSTANCE.event("ad_limit", null, obj2, false);
} catch (JSONException ignored) {
fun shouldShowOpenAd(): Boolean {
if (currentOpenRequest > open_max_request) {
LogEx.logDebug(TAG, "currentOpenRequest=$currentOpenRequest open_max_request=$open_max_request")
EventUtils.event("ad_limit", "currentOpenRequest=$currentOpenRequest open_max_request=$open_max_request")
return false
}
if (currentOpenShow > open_max_show) {
LogEx.logDebug(TAG, "currentOpenShow=$currentOpenShow open_max_show=$open_max_show")
EventUtils.event("ad_limit", "currentOpenShow=$currentOpenShow open_max_show=$open_max_show")
return false
}
return show;
if (currentOpenClick > open_max_click) {
LogEx.logDebug(TAG, "currentOpenClick=$currentOpenClick open_max_click=$open_max_click")
EventUtils.event("ad_limit", "currentOpenClick=$currentOpenClick open_max_click=$open_max_click")
return false
}
return true
}
//endregion
//region AdRequestCount
private int maxAdRequestCount = 0; // 最大广告请求次数
private int adRequestCount = 0; // 当前广告请求次数
private static final String MAX_AD_REQUEST_COUNT_KEY = "max_ad_request_count"; // 广告请求次数限制的键
private static final String AD_REQUEST_COUNT_KEY = "ad_request_count";//广告请求次数
//region inter
private void saveMaxAdRequestCount() {
SharedPreferences prefs = context.getSharedPreferences(AD_PREFS_NAME, 0);
SharedPreferences.Editor editor = prefs.edit();
editor.putInt(MAX_AD_REQUEST_COUNT_KEY, maxAdRequestCount);
editor.apply();
private val inter_max_request = AppPreferences.getInstance().getString(inter_limit_request, "15").toInt()
private val inter_max_show = AppPreferences.getInstance().getString(inter_limit_show, "10").toInt()
private val inter_max_click = AppPreferences.getInstance().getString(inter_limit_click, "1").toInt()
fun incrementInterRequestCount() {
currentInterRequest += 1
}
public void incrementAdRequestCount() {
if (!currentDate.equals(getCurrentDate())) {
currentDate = getCurrentDate();
adRequestCount = 0;
}
adRequestCount++;
saveAdRequestCount();
fun incrementInterShowCount() {
currentInterShow += 1
}
private String getAdRequestCountKey() {
return AD_REQUEST_COUNT_KEY + "_" + currentDate;
fun incrementInterClickCount() {
currentInterClick += 1
}
private void saveAdRequestCount() {
SharedPreferences prefs = context.getSharedPreferences(AD_PREFS_NAME, 0);
SharedPreferences.Editor editor = prefs.edit();
editor.putInt(getAdRequestCountKey(), adRequestCount);
editor.apply();
//当前插页请求次数
private var currentInterRequest = 0
get() {
return AppPreferences.getInstance().getInt("currentInterRequest_${currentDate()}", field)
}
//endregion
//region AdRequestFailCount
private int maxAdRequestFailCount; // 请求失败总
private int adRequestFailCount = 0; // 请求失败当前
private static final String MAX_AD_REQUEST_FAIL_COUNT_KEY = "max_ad_request_fail_count"; // 单个广告点击次数限制的键
private static final String AD_REQUEST_FAIL_COUNT_KEY = "ad_request_fail_count"; // 单个广告点击次数限制的键
private void saveMaxAdRequestFailCount() {
SharedPreferences prefs = context.getSharedPreferences(AD_PREFS_NAME, 0);
SharedPreferences.Editor editor = prefs.edit();
editor.putInt(MAX_AD_REQUEST_FAIL_COUNT_KEY, maxAdRequestFailCount);
editor.apply();
set(value) {
field = value
AppPreferences.getInstance().put("currentInterRequest_${currentDate()}", value, true)
}
public void incrementAdRequestFailCount() {
if (!currentDate.equals(getCurrentDate())) {
currentDate = getCurrentDate();
adRequestFailCount = 0;
//当前插页展示次数
private var currentInterShow = 0
get() {
return AppPreferences.getInstance().getInt("currentInterShow_${currentDate()}", field)
}
adRequestFailCount++;
saveAdRequestFailCount();
Log.d("glc", "广告请求失败:" + adRequestFailCount);
set(value) {
field = value
AppPreferences.getInstance().put("currentInterShow_${currentDate()}", value, true)
}
private String getAdRequestFailCountKey() {
return AD_REQUEST_FAIL_COUNT_KEY + "_" + currentDate;
//当前插页点击次数
private var currentInterClick = 0
get() {
return AppPreferences.getInstance().getInt("currentInterClick_${currentDate()}", field)
}
private void saveAdRequestFailCount() {
SharedPreferences prefs = context.getSharedPreferences(AD_PREFS_NAME, 0);
SharedPreferences.Editor editor = prefs.edit();
editor.putInt(getAdRequestFailCountKey(), adRequestFailCount);
editor.apply();
set(value) {
field = value
AppPreferences.getInstance().put("currentInterClick_${currentDate()}", value, true)
}
//endregion
//region AdDisplayCount
private int maxAdDisplayCount; // 总广告展示次数限制
private int adDisplayCount = 0; // 当前广告展示次数
private static final String MAX_AD_DISPLAY_COUNT_KEY = "max_ad_display_count"; // 总广告展示次数限制的键
private static final String AD_DISPLAY_COUNT_KEY = "ad_display_count"; // 广告展示次数的键
private void saveMaxAdDisplayCount() {
SharedPreferences prefs = context.getSharedPreferences(AD_PREFS_NAME, 0);
SharedPreferences.Editor editor = prefs.edit();
editor.putInt(MAX_AD_DISPLAY_COUNT_KEY, maxAdDisplayCount);
editor.apply();
fun shouldShowInterAd(): Boolean {
if (currentInterRequest > inter_max_request) {
LogEx.logDebug(TAG, "currentInterRequest=$currentInterRequest inter_max_request=$inter_max_request")
EventUtils.event("ad_limit", "currentInterRequest=$currentInterRequest inter_max_request=$inter_max_request")
return false
}
public void incrementAdDisplayCount() {
if (!currentDate.equals(getCurrentDate())) {
currentDate = getCurrentDate();
adDisplayCount = 0;
if (currentInterShow > inter_max_show) {
LogEx.logDebug(TAG, "currentInterShow=$currentInterShow inter_max_show=$inter_max_show")
EventUtils.event("ad_limit", "currentInterShow=$currentInterShow inter_max_show=$inter_max_show")
return false
}
adDisplayCount++;
int max = AppPreferences.getInstance().getInt("facebookAdShowEventCount", 3);
if (adClickCount >= max && max != -1) {
AppEventsLogger logger = AppEventsLogger.newLogger(context);
logger.logEvent("ad_show");
AppPreferences.getInstance().put("facebookAdShowEventCount", -1);
if (currentInterClick > inter_max_click) {
LogEx.logDebug(TAG, "currentInterClick=$currentInterClick inter_max_click=$inter_max_click")
EventUtils.event("ad_limit", "currentInterClick=$currentInterClick inter_max_click=$inter_max_click")
return false
}
saveAdDisplayCount();
return true
}
//endregion
//region native
private val native_max_request = AppPreferences.getInstance().getString(native_limit_request, "15").toInt()
private val native_max_show = AppPreferences.getInstance().getString(native_limit_show, "10").toInt()
private val native_max_click = AppPreferences.getInstance().getString(native_limit_show, "1").toInt()
private String getAdDisplayCountKey() {
return AD_DISPLAY_COUNT_KEY + "_" + currentDate;
fun incrementNativeRequestCount() {
currentNativeRequest += 1
}
private void saveAdDisplayCount() {
SharedPreferences prefs = context.getSharedPreferences(AD_PREFS_NAME, 0);
SharedPreferences.Editor editor = prefs.edit();
editor.putInt(getAdDisplayCountKey(), adDisplayCount);
editor.apply();
fun incrementNativeShowCount() {
currentNativeShow += 1
}
//endregion
//region AdClickCount
public int maxAdClickCount; // 单个广告点击次数限制
private int adClickCount = 0; // 当前广告点击次数
private static final String MAX_AD_CLICK_COUNT_KEY = "max_ad_click_count"; // 单个广告点击次数限制的键
private static final String AD_CLICK_COUNT_KEY = "ad_click_count"; // 广告点击次数的键
private void saveMaxAdClickCount() {
SharedPreferences prefs = context.getSharedPreferences(AD_PREFS_NAME, 0);
SharedPreferences.Editor editor = prefs.edit();
editor.putInt(MAX_AD_CLICK_COUNT_KEY, maxAdClickCount);
editor.apply();
fun incrementNativeClickCount() {
currentNativeClick += 1
}
public void incrementAdClickCount() {
LogEx.INSTANCE.logDebug(TAG, "incrementAdClickCount", false);
if (!currentDate.equals(getCurrentDate())) {
currentDate = getCurrentDate();
adClickCount = 0;
private var currentNativeRequest = 0
get() {
return AppPreferences.getInstance().getInt("currentNativeRequest_${currentDate()}", field)
}
adClickCount++;
saveAdClickCount();
set(value) {
field = value
AppPreferences.getInstance().put("currentNativeRequest_${currentDate()}", value, true)
}
private String getAdClickCountKey() {
return AD_CLICK_COUNT_KEY + "_" + currentDate;
private var currentNativeShow = 0
get() {
return AppPreferences.getInstance().getInt("currentNativeShow_${currentDate()}", field)
}
set(value) {
field = value
AppPreferences.getInstance().put("currentNativeShow_${currentDate()}", value, true)
}
public void setAdClickCount(int s) {
if (!currentDate.equals(getCurrentDate())) {
currentDate = getCurrentDate();
adClickCount = 0;
private var currentNativeClick = 0
get() {
return AppPreferences.getInstance().getInt("currentNativeClick_${currentDate()}", field)
}
adClickCount = s;
saveAdClickCount();
set(value) {
field = value
AppPreferences.getInstance().put("currentNativeClick_${currentDate()}", value, true)
}
private void saveAdClickCount() {
SharedPreferences prefs = context.getSharedPreferences(AD_PREFS_NAME, 0);
SharedPreferences.Editor editor = prefs.edit();
editor.putInt(getAdClickCountKey(), adClickCount);
editor.apply();
LogEx.INSTANCE.logDebug(TAG, "adClickCount=" + adClickCount, false);
fun shouldShowNative(): Boolean {
if (currentNativeRequest > native_max_request) {
LogEx.logDebug(TAG, "currentNativeRequest=$currentNativeRequest native_max_request=$native_max_request")
EventUtils.event("ad_limit", "currentNativeRequest=$currentNativeRequest native_max_request=$native_max_request")
return false
}
if (currentNativeShow > native_max_show) {
LogEx.logDebug(TAG, "currentNativeShow=$currentNativeShow native_max_show=$native_max_show")
EventUtils.event("ad_limit", "currentNativeShow=$currentNativeShow native_max_show=$native_max_show")
return false
}
if (currentNativeClick > native_max_click) {
LogEx.logDebug(TAG, "currentNativeClick=$currentNativeClick native_max_click=$native_max_click")
EventUtils.event("ad_limit", "currentNativeClick=$currentNativeClick native_max_click=$native_max_click")
return false
}
return true
}
//endregion
//endregion
public String getCurrentDate() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
Date currentDate = Calendar.getInstance().getTime();
return dateFormat.format(currentDate);
private val TAG = "AdDisplayUtils"
private fun currentDate(): String {
val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
val currentDate = Calendar.getInstance().time
return dateFormat.format(currentDate)
}
}
package com.base.pdfviewerscannerwhite.ads
import com.base.pdfviewerscannerwhite.utils.AppPreferences
import com.base.pdfviewerscannerwhite.utils.LogEx
import com.google.firebase.database.DataSnapshot
import com.google.firebase.database.DatabaseError
......@@ -27,7 +28,7 @@ object FirebaseDatabase {
const val inter_limit_show = "inter_limit_show"
const val inter_limit_click = "inter_limit_click"
//原生广告现在
//原生广告限制
const val native_limit_request = "native_limit_request"
const val native_limit_show = "native_limit_show"
const val native_limit_click = "native_limit_click"
......@@ -90,60 +91,63 @@ object FirebaseDatabase {
//可请求时间段间隔时间
const val ad_request_period_interval = "ad_request_period_interval"
fun saveDatabase2Sp() {
add(open_limit_request, "15")
add(open_limit_show, "10")
add(open_limit_click, "1")
add(inter_limit_request, "15")
add(inter_limit_show, "10")
add(inter_limit_click, "1")
add(native_limit_request, "15")
add(native_limit_show, "10")
add(native_limit_click, "1")
add(popup_count, "0")
add(popup_status, "1")
add(popup_style1_start, "7")
add(popup_style1_end, "11")
add(popup_style1_count, "0")
add(popup_style1_status, "1")
add(popup_style1_interval, "120")
add(popup_style2_start, "12")
add(popup_style2_end, "17")
add(popup_style2_count, "0")
add(popup_style2_status, "1")
add(popup_style2_interval, "120")
add(popup_style3_start, "18")
add(popup_style3_end, "24")
add(popup_style3_count, "0")
add(popup_style3_status, "1")
add(popup_style3_interval, "120")
add(showLanPage, "1")
add(open_ad_loading, "8000")
add(create_pdf_loading, "8000")
add(delete_loading, "8000")
add(open_file_loading, "8000")
add(merge_loading, "8000")
add(split_loading, "8000")
add(ad_request_period, "1")
add(ad_period_max_request, "10")
add(ad_request_period_interval, "60")
// add(open_limit_request, "15")
// add(open_limit_show, "10")
// add(open_limit_click, "1")
//
//
// add(inter_limit_request, "15")
// add(inter_limit_show, "10")
// add(inter_limit_click, "1")
//
// add(native_limit_request, "15")
// add(native_limit_show, "10")
// add(native_limit_click, "1")
//
// add(popup_count, "0")
// add(popup_status, "1")
//
// add(popup_style1_start, "7")
// add(popup_style1_end, "11")
// add(popup_style1_count, "0")
// add(popup_style1_status, "1")
// add(popup_style1_interval, "120")
//
// add(popup_style2_start, "12")
// add(popup_style2_end, "17")
// add(popup_style2_count, "0")
// add(popup_style2_status, "1")
// add(popup_style2_interval, "120")
//
// add(popup_style3_start, "18")
// add(popup_style3_end, "24")
// add(popup_style3_count, "0")
// add(popup_style3_status, "1")
// add(popup_style3_interval, "120")
//
// add(showLanPage, "1")
//
// add(open_ad_loading, "8000")
// add(create_pdf_loading, "8000")
// add(delete_loading, "8000")
// add(open_file_loading, "8000")
// add(merge_loading, "8000")
// add(split_loading, "8000")
//
// add(ad_request_period, "1")
// add(ad_period_max_request, "10")
// add(ad_request_period_interval, "60")
rootRef.addListenerForSingleValueEvent(object : ValueEventListener {
override fun onDataChange(dataSnapshot: DataSnapshot) {
var i = 0
for (snapshot in dataSnapshot.getChildren()) {
val key1 = snapshot.key
val value1 = snapshot.value
LogEx.logDebug("Database", "Key: $key1, Value: $value1")
i++
LogEx.logDebug("Database", "Key: $key1, Value: $value1 $i")
AppPreferences.getInstance().put(key1, value1)
}
}
......
......@@ -55,7 +55,7 @@ object AdmobInterstitialUtils {
return
}
if (!AdDisplayUtils.getInstance().shouldShowAd("interAd")) {
if (!AdDisplayUtils.shouldShowInterAd()) {
onHidden?.invoke(false)
return
}
......@@ -79,7 +79,7 @@ object AdmobInterstitialUtils {
onLoad?.invoke()
return
}
if (!AdDisplayUtils.getInstance().shouldShowAd("interAd")) {
if (!AdDisplayUtils.shouldShowInterAd()) {
onLoad?.invoke()
return
}
......@@ -152,7 +152,7 @@ object AdmobInterstitialUtils {
thisInterAd?.fullScreenContentCallback = object : FullScreenContentCallback() {
override fun onAdClicked() {
clickAd(thisInterAd?.responseInfo, "interAd")
AdDisplayUtils.getInstance().incrementAdClickCount()
AdDisplayUtils.incrementInterAdClickCount()
}
override fun onAdDismissedFullScreenContent() {
......@@ -172,7 +172,7 @@ object AdmobInterstitialUtils {
override fun onAdShowedFullScreenContent() {
dialog?.dismiss()
showAd(thisInterAd?.responseInfo, "interAd", activity)
AdDisplayUtils.getInstance().incrementAdDisplayCount()
AdDisplayUtils.incrementInterAdDisplayCount()
adLastDisplayTime = System.currentTimeMillis() / 1000
}
}
......
......@@ -40,7 +40,7 @@ object AdmobNativeUtils {
return
}
isLoading = true
if (!AdDisplayUtils.getInstance().shouldShowAd("nativeAd")) {
if (!AdDisplayUtils.shouldShowNative()) {
return
}
......@@ -88,7 +88,7 @@ object AdmobNativeUtils {
val obj = JSONObject()
obj.put("ad_unit", "NativeAd")
EventUtils.event("ad_prepare_show_native", ext = obj)
if (!AdDisplayUtils.getInstance().shouldShowAd("nativeAd")) {
if (!AdDisplayUtils.shouldShowNative()) {
return
}
loadingListener = {
......
......@@ -32,7 +32,7 @@ object AdmobOpenUtils {
onLoad?.invoke(1)
return
}
if (!AdDisplayUtils.getInstance().shouldShowAd("openAd")) {
if (!AdDisplayUtils.shouldShowOpenAd()) {
onLoad?.invoke(2)
return
}
......@@ -75,7 +75,7 @@ object AdmobOpenUtils {
if (activity.isFinishing || activity.isDestroyed) {
return
}
if (!AdDisplayUtils.getInstance().shouldShowAd("openAd")) {
if (!AdDisplayUtils.shouldShowOpenAd()) {
onHidden?.invoke(false)
return
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment