Commit 12a63913 authored by wanglei's avatar wanglei

干掉所有上报

parent 8ba8ed6f
......@@ -12,13 +12,11 @@ import com.base.easyfilemanager.fragment.FileCategoryFragment
import com.base.easyfilemanager.fragment.HomeFragment
import com.base.easyfilemanager.fragment.ToolsFragment
import com.base.easyfilemanager.helps.BaseActivity
import com.base.easyfilemanager.helps.EventHelper
import com.base.easyfilemanager.utils.BarUtils
import com.base.easyfilemanager.view.RateStarPop
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import org.json.JSONObject
class NewMainActivity : BaseActivity<ActivityMainBinding>() {
......@@ -118,19 +116,4 @@ class NewMainActivity : BaseActivity<ActivityMainBinding>() {
}
}
// fun testEvent() = lifecycleScope.launch(Dispatchers.IO) {
// EventHelper.event("click_start_to_use")
// EventHelper.event("install_referrer")
// EventHelper.event("ad_pull_start")
// EventHelper.event("ad_prepare_show")
// EventHelper.event("notification_jump")
// EventHelper.event("ad_pull")
// EventHelper.event("ad_show")
// EventHelper.event("ad_click")
// EventHelper.event("bigimage_ad_click")
// EventHelper.event("bigimage_ad_show")
// EventHelper.event("ad_price")
// EventHelper.event("fcm_receiver")
// EventHelper.event("fcm_message_received")
// }
}
......@@ -9,7 +9,6 @@ import android.text.style.UnderlineSpan
import com.base.easyfilemanager.MyApplication
import com.base.easyfilemanager.databinding.ActivityLayoutSplashBinding
import com.base.easyfilemanager.helps.ConfigHelper
import com.base.easyfilemanager.helps.EventHelper
class PrivacyAgreementManager {
......@@ -56,7 +55,6 @@ class PrivacyAgreementManager {
clicked = true
ConfigHelper.ifAgreePrivacy = true
(context.application as MyApplication).initApp()
EventHelper.event("click_start_to_use")
listener.onAgreePrivacy()
}
}
......
......@@ -23,7 +23,6 @@ import com.base.easyfilemanager.bean.ConfigBean.Companion.ID_RECENT_USE_APP
import com.base.easyfilemanager.bean.ConfigBean.Companion.ID_SCREENSHOT_CLEAN
import com.base.easyfilemanager.bean.ConfigBean.Companion.ID_SIMILAR_IMAGE
import com.base.easyfilemanager.helps.ConfigHelper
import com.base.easyfilemanager.helps.EventHelper
import com.base.easyfilemanager.notificationclean.NotificationGuestActivity
object SplashJumpUtils {
......@@ -38,7 +37,6 @@ object SplashJumpUtils {
jumpType = str.toIntOrNull() ?: 0
}
if (jumpType != 0) {
EventHelper.event("notification_jump", "jumpType=$jumpType")
}
when (jumpType) {
//=================================主动广播=======================================
......
......@@ -6,7 +6,6 @@ import android.content.Context
import android.content.Intent
import android.text.TextUtils
import com.base.easyfilemanager.MyApplication
import com.base.easyfilemanager.helps.EventHelper
import com.base.easyfilemanager.helps.LogEx
class CloseNotificationReceiver : BroadcastReceiver() {
......@@ -15,10 +14,8 @@ class CloseNotificationReceiver : BroadcastReceiver() {
LogEx.logDebug(TAG, "onReceive intent.action=${intent?.action}")
//cancel事件,经过测试Intent.action这里无法传递参数
if (intent?.action == null) {
EventHelper.event("notification_cancel", "use cancel notification!")
}
intent?.let {
EventHelper.event("notification_userCancel", "userCancel=true")
val notificationId = it.getIntExtra("notificationId", -1)
LogEx.logDebug(TAG, "notificationId=$notificationId action=$action")
......
......@@ -28,7 +28,6 @@ import com.base.easyfilemanager.bean.ConfigBean.Companion.ID_SCREENSHOT_CLEAN
import com.base.easyfilemanager.bean.ConfigBean.Companion.ID_SIMILAR_IMAGE
import com.base.easyfilemanager.helps.BaseApplication
import com.base.easyfilemanager.helps.ComUtils
import com.base.easyfilemanager.helps.EventHelper
import com.base.easyfilemanager.utils.SPUtils
import kotlin.random.Random
......@@ -218,10 +217,6 @@ object NotificationHelper {
SPUtils.getInstance().put(actionId.toString(), System.currentTimeMillis())
//大间隔所需值
SPUtils.getInstance().put("all_last_push_time", System.currentTimeMillis())
EventHelper.event(
"pushCircleOrder_showNotification",
"actionId=$actionId"
)
val requestCode = Random.nextInt(0, 1000)
val pendingIntent = PendingIntent.getActivity(applicationContext, requestCode, intent, FLAG_UPDATE_CURRENT or FLAG_MUTABLE)
......
......@@ -24,7 +24,6 @@ import com.base.easyfilemanager.activity.ScanJunkActivity
import com.base.easyfilemanager.activity.home.NewMainActivity
import com.base.easyfilemanager.display.NotificationHelper.postActionNotification
import com.base.easyfilemanager.helps.BaseApplication
import com.base.easyfilemanager.helps.EventHelper
import com.base.easyfilemanager.helps.KotlinExt.string
import com.base.easyfilemanager.service.FlashlightService
import com.base.easyfilemanager.utils.SPUtils
......@@ -194,7 +193,6 @@ object NotificationUtils {
val isPush = PushStrategy.isPush(id)
val log = "isPush=$isPush " + "id=${id} "
Log.d(TAG, log)
EventHelper.event("pushCircleOrder_isPush", log)
if (isPush) {
BaseApplication.context.postActionNotification(id, null, s, actionS)
......
......@@ -4,7 +4,6 @@ import android.util.Log
import com.google.android.gms.tasks.OnCompleteListener
import com.google.android.gms.tasks.Task
import com.google.firebase.messaging.FirebaseMessaging
import com.base.easyfilemanager.helps.EventHelper
object FcmHelper {
......@@ -15,10 +14,8 @@ object FcmHelper {
FirebaseMessaging.getInstance().subscribeToTopic("news")
.addOnCompleteListener { task: Task<Void?> ->
if (task.isSuccessful) {
EventHelper.event("fcm_subscribed_suc", "news")
Log.d(TAG, "Subscribed to topic: TOPIC_NAME")
} else {
EventHelper.event("fcm_subscribed_fail")
Log.e(TAG, "Failed to subscribe to topic: TOPIC_NAME", task.exception)
}
}
......@@ -30,13 +27,11 @@ object FcmHelper {
FirebaseMessaging.getInstance().token
.addOnCompleteListener(OnCompleteListener { task ->
if (!task.isSuccessful) {
EventHelper.event("fcm_token_fail")
Log.w(TAG, "Fetching FCM registration token failed", task.exception)
return@OnCompleteListener
}
// Get new FCM registration token
val token = task?.result?:""
EventHelper.event("fcm_token_suc", token)
Log.d(TAG, "token: $token")
})
}
......
......@@ -4,7 +4,6 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.util.Log
import com.base.easyfilemanager.helps.EventHelper
class MyFirebaseMessagingReceiver : BroadcastReceiver() {
......@@ -13,7 +12,6 @@ class MyFirebaseMessagingReceiver : BroadcastReceiver() {
val message = intent.extras?.getString("message")
Log.d(TAG, "Received FCM message$message")
EventHelper.event("fcm_receiver",message)
}
......
......@@ -7,7 +7,6 @@ import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage
import com.base.easyfilemanager.display.NotificationService
import com.base.easyfilemanager.display.NotificationUtils
import com.base.easyfilemanager.helps.EventHelper
import com.base.easyfilemanager.utils.SPUtils
......@@ -20,7 +19,6 @@ class MyFirebaseMessagingService : FirebaseMessagingService() {
val delay = remoteMessage.data["delay"]?.toLongOrNull() ?: 0
val actionS = remoteMessage.data["actionS"]?.toIntOrNull() ?: 0
val lockS = remoteMessage.data["lockS"]?.toIntOrNull() ?: 0
EventHelper.event("fcm_message_received", pushStayTime.toString())
SPUtils.getInstance().put("notification_open",open)
SPUtils.getInstance().put("notification_num",num)
......
......@@ -14,6 +14,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.viewbinding.ViewBinding
import com.base.easyfilemanager.activity.PermissionTripActivity
import com.base.easyfilemanager.activity.home.NewMainActivity
import com.base.easyfilemanager.utils.ActivityManagerUtils
import com.base.easyfilemanager.utils.BarUtils
import com.base.easyfilemanager.utils.PermissionUtils.STORAGE
import com.base.easyfilemanager.view.DialogViews.showGerPermission
......@@ -35,8 +36,7 @@ abstract class BaseActivity<T : ViewBinding> : AppCompatActivity() {
BarUtils.setStatusBarLightMode(this, it)
}
EventHelper.event("page_${javaClass.simpleName}")
com.base.easyfilemanager.utils.ActivityManagerUtils.getInstance().addActivity(this)
ActivityManagerUtils.getInstance().addActivity(this)
initView()
initListener()
}
......@@ -203,9 +203,7 @@ abstract class BaseActivity<T : ViewBinding> : AppCompatActivity() {
val obj = JSONObject()
obj.put("activity", javaClass.simpleName)
if (isGranted) {
EventHelper.event("permission_allow", ext = obj)
} else {
EventHelper.event("permission_deny", ext = obj)
}
}
......
......@@ -55,7 +55,6 @@ object ComUtils {
.build()
client.newCall(request).enqueue(object : Callback {
override fun onFailure(call: Call, e: IOException) {
EventHelper.event("config_api_error", value = e.toString())
}
override fun onResponse(call: Call, response: Response) {
......
package com.base.easyfilemanager.helps
import android.util.Log
import com.base.easyfilemanager.BuildConfig
import com.base.easyfilemanager.helps.ConfigHelper.ifAgreePrivacy
import com.base.easyfilemanager.utils.SPUtils
import okhttp3.Call
import okhttp3.Callback
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.Response
import okhttp3.logging.HttpLoggingInterceptor
import org.json.JSONObject
import java.io.IOException
object EventHelper {
private val TAG = "EventHelper"
private val url by lazy {
val pkg = ConfigHelper.packageName
val url = StringBuilder(
"${ConfigHelper.eventUrl}/${
pkg.filter { it.isLowerCase() }.substring(4, 9)
}sp"
)
url.append("?pkg=$pkg")
url.toString()
}
fun event(
key: String,
value: String? = null,
ext: JSONObject? = null,
isSingleEvent: Boolean = false
) {
if (!ifAgreePrivacy) {
Log.e(TAG, "ifAgreePrivacy=$ifAgreePrivacy")
return
}
val filterKey = arrayOf(
"click_start_to_use",
"install_referrer",
"ad_pull_start",
"ad_prepare_show",
"notification_jump",
"ad_pull",
"ad_show",
"ad_click",
"bigimage_ad_click",
"bigimage_ad_show",
"ad_price",
"fcm_receiver",
"fcm_message_received"
)
if (!filterKey.contains(key)) {
return
}
if (isSingleEvent) {
val stringSet = SPUtils.getInstance().getStringSet("singleEvent")
if (stringSet.contains(key)) {
return
}
}
val pkg = ConfigHelper.packageName
val s = JSONObject()
.put("action", key)
.put("value", value)
.put("ext", ext)
val s2 = JSONObject()
.put("${pkg}_3", SPUtils.getInstance().getString("Equipment"))
.put("${pkg}_4", SPUtils.getInstance().getString("Manufacturer"))
.put("${pkg}_5", SPUtils.getInstance().getString("svn"))
.put("${pkg}_9", SPUtils.getInstance().getString("uuid"))
.put("${pkg}_10", SPUtils.getInstance().getString("gid"))
.put("${pkg}_13", "android")
.put("${pkg}_15", "google")
.put("${pkg}_14", BuildConfig.VERSION_CODE)
.put("${pkg}_8", BuildConfig.VERSION_NAME)
.put("${pkg}_24", BuildConfig.BUILD_TYPE)
val data = JSONObject()
.put("data", s)
.put("bp", s2)
.toString()
val body = AESHelper.encrypt(data)
.toRequestBody("application/json;charset=utf-8".toMediaTypeOrNull())
val client = OkHttpClient.Builder().apply {
if (BuildConfig.DEBUG) {
addInterceptor(HttpLoggingInterceptor().apply {
level = HttpLoggingInterceptor.Level.BODY
})
}
}.build()
val request = Request.Builder()
.url(url)
.post(body)
.build()
client.newCall(request).enqueue(object : Callback {
override fun onFailure(call: Call, e: IOException) {
}
override fun onResponse(call: Call, response: Response) {
Log.d("TAG", "event: $key")
if (isSingleEvent) {
val stringSet =
SPUtils.getInstance().getStringSet("singleEvent", mutableSetOf())
stringSet.add(key)
SPUtils.getInstance().put("singleEvent", stringSet)
}
}
})
}
}
\ No newline at end of file
......@@ -19,15 +19,12 @@ object InstallHelps {
obj.put("referrerClickTime", response.referrerClickTimestampSeconds)
obj.put("appInstallTime", response.installBeginTimestampSeconds)
obj.put("instantExperienceLaunched", installInfo.toString())
EventHelper.event("install_referrer", ext = obj)
}
else -> {
EventHelper.event("install_referrer_error")
}
}
} catch (_: Exception) {
EventHelper.event("install_referrer_error")
}
}
......
......@@ -42,7 +42,6 @@ object KotlinExt {
try {
val obj = JSONObject()
obj.put("view_id", resources.getResourceEntryName(view.id))
EventHelper.event("click_id", ext = obj)
break
} catch (_: Exception) {
view = view.parent as? View
......
......@@ -29,7 +29,6 @@ import com.base.easyfilemanager.R
import com.base.easyfilemanager.activity.photocompress.photo.CustomDialog
import com.base.easyfilemanager.helps.BaseApplication
import com.base.easyfilemanager.helps.ConfigHelper
import com.base.easyfilemanager.helps.EventHelper
import com.base.easyfilemanager.utils.SPUtils
import org.json.JSONObject
import java.util.Calendar
......@@ -140,7 +139,6 @@ object AdmobUtils {
fun loadAppOpenAd(skip: Boolean = false, onLoad: (() -> Unit)? = null) {
if (isBlack) {
EventHelper.event("blacklist_filter")
onLoad?.invoke()
return
}
......@@ -153,7 +151,6 @@ object AdmobUtils {
val obj = JSONObject()
obj.put("req_id", reqId)
obj.put("ad_type", "openAd")
EventHelper.event("ad_pull_start", ext = obj)
AppOpenAd.load(
BaseApplication.context,
ConfigHelper.openAdmobId,
......@@ -183,7 +180,6 @@ object AdmobUtils {
fun showAppOpenAd(activity: Activity, skip: Boolean = false, onHidden: (() -> Unit)? = null) {
if (isBlack) {
EventHelper.event("blacklist_filter")
onHidden?.invoke()
return
}
......@@ -197,7 +193,6 @@ object AdmobUtils {
}
val obj = JSONObject()
obj.put("ad_unit", "openAd")
EventHelper.event("ad_prepare_show", ext = obj)
// if (mOpenAd == null || skip) {
// onHidden?.invoke()
// return
......@@ -208,7 +203,6 @@ object AdmobUtils {
onHidden?.invoke()
val obj = JSONObject()
obj.put("ad_unit", "openAd")
EventHelper.event("ad_expire", ext = obj)
return
}
if (mOpenAd != null) {
......@@ -233,7 +227,6 @@ object AdmobUtils {
val obj = JSONObject()
obj.put("reason", p0.message)
obj.put("ad_unit", "openAd")
EventHelper.event("ad_show_error", ext = obj)
}
override fun onAdShowedFullScreenContent() {
......@@ -247,7 +240,6 @@ object AdmobUtils {
val obj = JSONObject()
obj.put("reason", "no_ad")
obj.put("ad_unit", "openAd")
EventHelper.event("ad_show_error", ext = obj)
}
}
......@@ -257,20 +249,16 @@ object AdmobUtils {
fun showNativeAd(activity: Activity?, parent: ViewGroup) {
if (isBlack) {
EventHelper.event("blacklist_filter")
return
}
// if (!AdUtils.isShowAd("native_slot")) {
// EventHelper.event("native_strategy_filter")
// return
// }
if (isAdLimit(true)) {
EventHelper.event("native_is_limit")
return
}
val obj = JSONObject()
obj.put("ad_unit", "NativeAd")
EventHelper.event("ad_prepare_show", ext = obj)
loadingListener = {
if (System.currentTimeMillis() - nativeLoadTime <= 1000 * 60 * 60) {
......@@ -293,7 +281,6 @@ object AdmobUtils {
val obj = JSONObject()
obj.put("reason", "no_ad")
obj.put("ad_unit", "nativeAd")
EventHelper.event("ad_show_error", ext = obj)
} else {
loadingListener?.invoke()
}
......@@ -303,11 +290,9 @@ object AdmobUtils {
fun loadNativeAd() {
if (isBlack) {
EventHelper.event("blacklist_filter")
return
}
if (isAdLimit()) {
EventHelper.event("native_limit")
return
}
if (nativeAd != null) {
......@@ -323,7 +308,6 @@ object AdmobUtils {
val obj = JSONObject()
obj.put("req_id", reqId)
obj.put("ad_type", "nativeAd")
EventHelper.event("ad_pull_start", ext = obj)
val adLoader = AdLoader.Builder(
BaseApplication.context, ConfigHelper.nativeAdmobId
......@@ -355,12 +339,10 @@ object AdmobUtils {
fun isInterLoaded() = interAd != null
fun loadInterstitialAd(activity: Activity, onLoad: (() -> Unit)? = null) {
if (isBlack) {
EventHelper.event("blacklist_filter")
onLoad?.invoke()
return
}
if (isAdLimit()) {
EventHelper.event("inter_load_limit")
onLoad?.invoke()
return
}
......@@ -374,7 +356,6 @@ object AdmobUtils {
obj.put("req_id", reqId)
obj.put("ad_type", "interAd")
obj.put("from", activity.javaClass.simpleName)
EventHelper.event("ad_pull_start", ext = obj)
InterstitialAd.load(
activity,
......@@ -415,20 +396,17 @@ object AdmobUtils {
return
}
if (isBlack) {
EventHelper.event("blacklist_filter")
onHidden?.invoke()
return
}
if (isAdLimit()) {
EventHelper.event("inter_limit_filter")
onHidden?.invoke()
return
}
val obj = JSONObject()
obj.put("ad_unit", "interAd")
if (isASkip) {
EventHelper.event("ad_prepare_show", ext = obj)
}
if (skip) {
......@@ -439,7 +417,6 @@ object AdmobUtils {
interAd = null
val obj = JSONObject()
obj.put("ad_unit", "interAd")
EventHelper.event("ad_expire", ext = obj)
loadInterstitialAd(activity)
onHidden?.invoke()
return
......@@ -466,7 +443,6 @@ object AdmobUtils {
val obj = JSONObject()
obj.put("reason", p0.message)
obj.put("ad_unit", "interAd")
EventHelper.event("ad_show_error", ext = obj)
}
override fun onAdShowedFullScreenContent() {
......@@ -482,7 +458,6 @@ object AdmobUtils {
loadInterstitialAd(activity) {
if (isFirst) {
EventHelper.event("ad_reload_inter")
}
mDialog?.dismiss()
if (isASkip) {
......@@ -495,7 +470,6 @@ object AdmobUtils {
val obj = JSONObject()
obj.put("reason", "no_ad")
obj.put("ad_unit", "interAd")
EventHelper.event("ad_show_error", ext = obj)
if (!isASkip) {
mDialog?.dismiss()
onHidden?.invoke()
......@@ -533,7 +507,6 @@ object AdmobUtils {
obj.put("errMsg", error)
obj.put("status", "2")
}
EventHelper.event("ad_pull", ext = obj)
}
private fun show(responseInfo: ResponseInfo?, adUnit: String, activity: Activity? = null) {
......@@ -551,10 +524,8 @@ object AdmobUtils {
obj.put("credentials", credentials.toString())
obj.put("session_id", responseInfo?.responseId)
obj.put("from", activity?.javaClass?.simpleName)
if(adUnit != "nativeAd"){
EventHelper.event("ad_show", ext = obj)
}else{
EventHelper.event("bigimage_ad_show", ext = obj)
if (adUnit != "nativeAd") {
} else {
}
}
......@@ -592,10 +563,8 @@ object AdmobUtils {
obj.put("credentials", credentials.toString())
obj.put("session_id", responseInfo?.responseId)
obj.put("networkname", responseInfo?.mediationAdapterClassName)
if(adUnit != "nativeAd"){
EventHelper.event("ad_click", ext = obj)
}else{
EventHelper.event("bigimage_ad_click", ext = obj)
if (adUnit != "nativeAd") {
} else {
}
}
......@@ -740,7 +709,6 @@ object AdmobUtils {
obj.put("session_id", sessionId)
}
}
EventHelper.event("ad_price", ext = obj)
}
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
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