Commit fc29fff5 authored by wanglei's avatar wanglei

Merge remote-tracking branch 'origin/master'

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