Commit eacf3173 authored by wanglei's avatar wanglei

...

parent 4bcf42c8
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