Commit fc29fff5 authored by wanglei's avatar wanglei

Merge remote-tracking branch 'origin/master'

parents 00d202cc 35d3f4c4
......@@ -71,16 +71,17 @@ public class AdDisplayUtils {
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) {
if (!s) {
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;
}
......
......@@ -61,7 +61,7 @@ object AdMaxEvent {
}
fun showAd(ad: MaxAd?, adUnit: String,activity: Activity) {
fun showAd(ad: MaxAd?, adUnit: String,activity: Activity?) {
val obj = JSONObject()
obj.put("UnitId", ad?.adUnitId)
obj.put("ad_unit", adUnit)
......@@ -74,7 +74,8 @@ object AdMaxEvent {
obj.put("networkplacement", ad?.networkPlacement)
obj.put("latency", ad?.requestLatencyMillis)
obj.put("valueMicros", ad?.revenue)
obj.put("from",activity.javaClass.simpleName)
obj.put("from",activity?.javaClass?.simpleName)
LogEx.logDebug("glc","from: "+activity?.javaClass?.simpleName)
if(!adUnit.equals("nativeAd")){
EventUtils.event("ad_show", ext = obj)
}else{
......
......@@ -32,7 +32,6 @@ object AdMaxInterstitialUtils {
private fun setListener(activity: Activity) {
if (interstitialAd == null) {
val reqId = UUID.randomUUID().toString()
val obj = JSONObject()
obj.put("req_id", reqId)
......@@ -87,7 +86,7 @@ object AdMaxInterstitialUtils {
val obj2 = JSONObject()
obj2.put("code", p1.code)
obj2.put("reason", p1.message)
obj2.put("ad_unit", "interstitialAd")
obj2.put("ad_unit", "interAd")
EventUtils.event("ad_show_error", ext = obj2)
}
})
......@@ -95,18 +94,12 @@ object AdMaxInterstitialUtils {
}
}
fun showInterstitialAd(
activity: Activity,
onHidden: (() -> Unit)? = null
) {
fun showInterstitialAd(activity: Activity, onHidden: (() -> Unit)? = null) {
setListener(activity)
if (activity.isFinishing || activity.isDestroyed) {
return
}
val obj1 = JSONObject()
obj1.put("ad_unit", "interAd")
EventUtils.event("ad_prepare_show", ext = obj1)
if (isAdExpired()) {
val obj2 = JSONObject()
......@@ -123,10 +116,14 @@ object AdMaxInterstitialUtils {
return
}
val obj1 = JSONObject()
obj1.put("ad_unit", "interAd")
EventUtils.event("ad_prepare_show", ext = obj1)
this.onHidden = onHidden
if (interstitialAd?.isReady == true) {
LogEx.logDebug(TAG, "isReady=true")
interstitialAd?.showAd()
interstitialAd?.showAd(activity)
} else {
LogEx.logDebug(TAG, "onAdDisplayFailed")
val obj2 = JSONObject()
......@@ -155,7 +152,7 @@ object AdMaxInterstitialUtils {
}
loadingListener = {
customDialog?.dismiss()
interstitialAd?.showAd()
interstitialAd?.showAd(activity)
loadingListener = null
}
......
......@@ -105,7 +105,9 @@ object AdMaxOpenUtils {
LogEx.logDebug(TAG, "showAppOpenAd continue")
val obj1 = JSONObject()
obj1.put("ad_unit", "openAd")
EventUtils.event("ad_prepare_show", ext = obj1)
AdMaxOpenUtils.onHidden = onHidden
if (appOpenAd?.isReady == true) {
......@@ -116,9 +118,6 @@ object AdMaxOpenUtils {
loadingListener = {
LogEx.logDebug(TAG, "loadingListener callback")
loaded?.invoke()
val obj1 = JSONObject()
obj1.put("ad_unit", "openAd")
EventUtils.event("ad_prepare_show", ext = obj1)
appOpenAd?.showAd()
loadingListener = null
}
......
......@@ -62,37 +62,37 @@ object NotificationUtil {
ID_SIMILAR_IMAGE -> {
icon = R.mipmap.h_similar
desc = DuplicatePhotoStringResourceManager.getNextCopy()
btn = "Clean up"
btn = "Clean Up Space"
}
ID_SCREENSHOT_CLEAN -> {
icon = R.mipmap.repeatedphotos
desc = ScreenshotCleanupStringManager.getNextCleanupCopy()
btn = "Remove Screenshots"
btn = "Clean Up Space"
}
ID_RECOVERY_PHOTOS -> {
icon = R.mipmap.photos_ss
desc = PhotoRecoveryStringManager.getNextRecoveryCopy()
btn = "Retrieve Photo"
btn = "Recovery"
}
ID_RECOVERY_VIDEOS -> {
icon = R.mipmap.videos_ss
desc = VideoRecoveryStringManager.getNextRecoveryCopy()
btn = "Recover Video"
btn = "Recovery"
}
ID_RECOVERY_DOCUMENTS -> {
icon = R.mipmap.documents_ss
desc = DocumentRecoveryStringManager.getNextRecoveryCopy()
btn = "Restore Document"
btn = "Recovery"
}
ID_PRIVACY_SPACE -> {
icon = R.mipmap.space
desc = PrivacySpaceStringManager.getNextPrivacySpaceCopy()
btn = "Hide Content"
btn = "Hide"
}
}
bigRemoteViews.setImageViewResource(R.id.iv_icon, icon)
......@@ -217,7 +217,7 @@ object NotificationUtil {
fun sendNotification(context: Context) {
val currentNum = AppPreferences.getInstance().getInt("showNotificationCount_" + AdDisplayUtils.getInstance().getCurrentDate(), 0)
val maxNum = AppPreferences.getInstance().getString("maxShowNotificationCount", "100").toIntOrNull()?:100
val maxNum = AppPreferences.getInstance().getString("maxShowNotificationCount", "156").toIntOrNull()?:156
if (currentNum >= maxNum) {
LogEx.logDebug("glc","currentNum >= maxNum")
return
......
......@@ -30,7 +30,9 @@ object InstallHelps {
if (listOf("gclid", "facebook", "instagram").all { !installInfo.contains(it, true) }) {
//自然用户
AppPreferences.getInstance().put("install_source", "origin")
LogEx.logDebug("glc","origin user")
} else {
LogEx.logDebug("glc","channel user")
//渠道用户
AppPreferences.getInstance().put("install_source", "channel")
}
......
......@@ -99,6 +99,7 @@ object NewComUtils {
AdDisplayUtils.getInstance().maxAdRequestFailCount =
AppPreferences.getInstance().getString("adRequestFailCount", "20").toInt()
}
}
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