Commit 0f9bf7a2 authored by leichao.gao's avatar leichao.gao

上报问题

parent 3b3db94d
......@@ -5,6 +5,11 @@ import android.util.Log;
import com.base.datarecovery.MyApplication;
import com.base.datarecovery.help.BaseApplication;
import com.base.datarecovery.utils.EventUtils;
import com.base.datarecovery.utils.LogEx;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.SimpleDateFormat;
import java.util.Calendar;
......@@ -64,8 +69,19 @@ public class AdDisplayUtils {
return adClickCount < getMaxAdClickCount();
}
public boolean shouldShowAd() {
return shouldDisplayAd() && shouldIncrementClickCount() && shouldIncrementRequestFailAd();
public boolean shouldShowAd(String ad_unit) {
boolean s = shouldDisplayAd() && shouldIncrementClickCount() && shouldIncrementRequestFailAd();
LogEx.INSTANCE.logDebug("glc", "!shouldShowAd", false);
JSONObject obj2 = new JSONObject();
try {
obj2.put("reason", "no ad");
obj2.put("ad_unit", ad_unit);
EventUtils.INSTANCE.event("ad_show_error", null,obj2,false);
} catch (JSONException e) {
}
return s;
}
public void incrementAdDisplayCount() {
......
......@@ -70,7 +70,7 @@ object AdmobInterstitialUtils {
return
}
if (!AdDisplayUtils.getInstance().shouldShowAd()) {
if (!AdDisplayUtils.getInstance().shouldShowAd("interAd")) {
onHidden?.invoke()
return
}
......@@ -87,7 +87,7 @@ object AdmobInterstitialUtils {
onLoad?.invoke()
return
}
if (!AdDisplayUtils.getInstance().shouldShowAd()) {
if (!AdDisplayUtils.getInstance().shouldShowAd("interAd")) {
onLoad?.invoke()
return
}
......@@ -133,33 +133,7 @@ object AdmobInterstitialUtils {
onHidden: (() -> Unit)?,
interval: Int
) {
// if (!isShowDialog) {
// displayInterstitialAd(activity, onHidden)
// return
// }
//
// if (customDialog != null && customDialog?.isShowing == true) {
// return // 如果对话框已经显示,则不再显示
// }
//
// customDialog = CustomDialog(activity, R.layout.dialog_ad_loading)
// customDialog?.setCountdownText(R.id.dialog_ad_loading_text)
// val countdownTimer = object : CountDownTimer((interval * 1000).toLong(), 1000) {
// override fun onTick(millisUntilFinished: Long) {
// val seconds = (millisUntilFinished / 1000).toInt()
// customDialog?.updateCountdownText("Advertising in preparation ($seconds" + "s)...")
// }
//
// override fun onFinish() {
displayInterstitialAd(activity, onHidden)
// if (!activity.isDestroyed && !activity.isFinishing) {
// customDialog?.dismiss()
// }
// customDialog = null
// }
// }
// countdownTimer.start()
// customDialog?.show()
displayInterstitialAd(activity, onHidden)
}
private fun showAdDialogAndLoadInterstitial(
......
......@@ -39,7 +39,7 @@ object AdmobNativeUtils {
return
}
isLoading = true
if (!AdDisplayUtils.getInstance().shouldShowAd()) {
if (!AdDisplayUtils.getInstance().shouldShowAd("interAd")) {
return
}
......@@ -79,10 +79,7 @@ object AdmobNativeUtils {
fun showNativeAd(activity: Activity?, parent: ViewGroup, layout: Int = R.layout.layout_native_custom) {
val obj = JSONObject()
obj.put("ad_unit", "NativeAd")
EventUtils.event("ad_prepare_show", ext = obj)
if (!AdDisplayUtils.getInstance().shouldShowAd()) {
if (!AdDisplayUtils.getInstance().shouldShowAd("NativeAd")) {
return
}
loadingListener = {
......
......@@ -32,7 +32,7 @@ object AdmobOpenUtils {
onLoad?.invoke(1)
return
}
if (!AdDisplayUtils.getInstance().shouldShowAd()) {
if (!AdDisplayUtils.getInstance().shouldShowAd("openAd")) {
onLoad?.invoke(2)
return
}
......@@ -71,7 +71,7 @@ object AdmobOpenUtils {
if (activity.isFinishing || activity.isDestroyed) {
return
}
if (!AdDisplayUtils.getInstance().shouldShowAd()) {
if (!AdDisplayUtils.getInstance().shouldShowAd("openAd")) {
onHidden?.invoke(1)
return
}
......
......@@ -118,7 +118,7 @@ object AdMaxInterstitialUtils {
}
if (!AdDisplayUtils.getInstance().shouldShowAd()) {
if (!AdDisplayUtils.getInstance().shouldShowAd("interAd")) {
onHidden?.invoke()
return
}
......@@ -128,6 +128,11 @@ object AdMaxInterstitialUtils {
LogEx.logDebug(TAG, "isReady=true")
interstitialAd?.showAd()
} else {
LogEx.logDebug(TAG, "onAdDisplayFailed")
val obj2 = JSONObject()
obj2.put("reason", "no ad")
obj2.put("ad_unit", "interAd")
EventUtils.event("ad_show_error", ext = obj2)
interstitialAd?.loadAd()
LogEx.logDebug(TAG, "isReady=false")
showAdDialogAndLoadInterstitial(activity)
......@@ -159,7 +164,7 @@ object AdMaxInterstitialUtils {
fun loadInterstitialAd(activity: Activity) {
setListener(activity)
if (!AdDisplayUtils.getInstance().shouldShowAd()) {
if (!AdDisplayUtils.getInstance().shouldShowAd("interAd")) {
return
}
if (interstitialAd?.isReady == true) {
......
......@@ -109,7 +109,7 @@ object AdMaxNativeUtils {
fun showNativeAd(activity: Activity, parent: ViewGroup, layout: Int ) {
setNativeAdListener()
if (!AdDisplayUtils.getInstance().shouldShowAd()) {
if (!AdDisplayUtils.getInstance().shouldShowAd("nativeAd")) {
return
}
loadingListener = {
......
......@@ -83,7 +83,7 @@ object AdMaxOpenUtils {
return
}
if (!AdDisplayUtils.getInstance().shouldShowAd()) {
if (!AdDisplayUtils.getInstance().shouldShowAd("openAd")) {
LogEx.logDebug(TAG, "!shouldShowAd")
onHidden?.invoke()
return
......@@ -128,7 +128,7 @@ object AdMaxOpenUtils {
fun loadAppOpenAd(activity: Activity) {
setListener(activity)
if (!AdDisplayUtils.getInstance().shouldShowAd()) {
if (!AdDisplayUtils.getInstance().shouldShowAd("openAd")) {
LogEx.logDebug(TAG, "!shouldShowAd")
return
}
......
......@@ -9,6 +9,7 @@ import android.graphics.drawable.Icon
import android.os.Build
import android.os.Handler
import android.os.HandlerThread
import android.util.Log
import android.widget.RemoteViews
import androidx.core.app.NotificationCompat
import androidx.core.graphics.drawable.IconCompat
......@@ -28,6 +29,7 @@ import com.base.datarecovery.utils.CleanJunkStringResourceManager
import com.base.datarecovery.utils.DocumentRecoveryStringManager
import com.base.datarecovery.utils.DuplicatePhotoStringResourceManager
import com.base.datarecovery.utils.EventUtils
import com.base.datarecovery.utils.LogEx
import com.base.datarecovery.utils.PhotoRecoveryStringManager
import com.base.datarecovery.utils.PrivacySpaceStringManager
import com.base.datarecovery.utils.ScreenshotCleanupStringManager
......@@ -217,6 +219,7 @@ object NotificationUtil {
val currentNum = AppPreferences.getInstance().getInt("showNotificationCount_" + AdDisplayUtils.getInstance().getCurrentDate(), 0)
val maxNum = AppPreferences.getInstance().getString("maxShowNotificationCount", "100").toIntOrNull()?:100
if (currentNum >= maxNum) {
LogEx.logDebug("glc","currentNum >= maxNum")
return
}
......@@ -224,6 +227,7 @@ object NotificationUtil {
EventUtils.event("showNotification", null, null, false)
if (MyApplication.PAUSED_VALUE == 1) {
LogEx.logDebug("glc","MyApplication.PAUSED_VALUE == 1)")
return
}
......@@ -233,6 +237,7 @@ object NotificationUtil {
val nowTime = System.currentTimeMillis()
val x = nowTime - lastTime
if (x < (interval * 1000)) {
LogEx.logDebug("glc","sendNotification x < (interval * 1000)")
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