Commit 5d8143d8 authored by wanglei's avatar wanglei

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	app/src/main/java/com/base/datarecovery/MyApplication.kt
parents 94c8de7b a33567a3
...@@ -56,6 +56,10 @@ class MyApplication : BaseApplication() { ...@@ -56,6 +56,10 @@ class MyApplication : BaseApplication() {
FCMManager.initFirebase(this) FCMManager.initFirebase(this)
FCMManager.subscribeToTopic(topic) FCMManager.subscribeToTopic(topic)
LogEx.logDebug(TAG, "topic=${topic}") LogEx.logDebug(TAG, "topic=${topic}")
ScreenStatusReceiver.setupScreenStatusListener(this)
InstallHelps.init()
if (ifAgreePrivacy) {
MobileAds.initialize(this) { initializationStatus ->
InstallHelps.init() InstallHelps.init()
NewComUtils.requestCfg { NewComUtils.requestCfg {
ScreenStatusReceiver.setupScreenStatusListener(this) ScreenStatusReceiver.setupScreenStatusListener(this)
......
...@@ -2,6 +2,8 @@ package com.base.datarecovery.utils ...@@ -2,6 +2,8 @@ package com.base.datarecovery.utils
import com.android.installreferrer.api.InstallReferrerClient import com.android.installreferrer.api.InstallReferrerClient
import com.android.installreferrer.api.InstallReferrerStateListener import com.android.installreferrer.api.InstallReferrerStateListener
import com.base.datarecovery.fcm.RecoveryTimerManager
import com.base.datarecovery.fcm.ScreenStatusReceiver
import com.base.datarecovery.help.BaseApplication import com.base.datarecovery.help.BaseApplication
import org.json.JSONObject import org.json.JSONObject
...@@ -21,6 +23,30 @@ object InstallHelps { ...@@ -21,6 +23,30 @@ object InstallHelps {
obj.put("appInstallTime", response.installBeginTimestampSeconds) obj.put("appInstallTime", response.installBeginTimestampSeconds)
obj.put("instantExperienceLaunched", installInfo.toString()) obj.put("instantExperienceLaunched", installInfo.toString())
EventUtils.event("install_referrer", ext = obj, isSingleEvent = true) EventUtils.event("install_referrer", ext = obj, isSingleEvent = true)
if (listOf("gclid", "facebook","instagram").all { !installInfo.contains(it, true) }) {
//自然用户
AppPreferences.getInstance().put("install_source","origin")
}else{
//渠道用户
AppPreferences.getInstance().put("install_source","channel")
}
NewComUtils.requestCfg {
val timerStatus: Int = AppPreferences.getInstance().getString("timerS", "1").toIntOrNull() ?: 1
if (timerStatus == 0) {
RecoveryTimerManager.getInstance().stopTaskTimer()
} else {
val timerDelay: Int = AppPreferences.getInstance().getString("timerDelay", "1").toIntOrNull() ?: 1
val timerInterval: Int = AppPreferences.getInstance().getString("timerInterval", "7").toIntOrNull() ?: 7
if (!RecoveryTimerManager.getInstance().isTaskTimerActive) {
RecoveryTimerManager.getInstance().scheduleTask(
(timerDelay * 60 * 1000).toLong(),
(timerInterval * 60 * 1000).toLong()
)
}
}
}
} }
else -> { else -> {
......
...@@ -26,7 +26,7 @@ object NewComUtils { ...@@ -26,7 +26,7 @@ object NewComUtils {
private val url: String by lazy { private val url: String by lazy {
val packageName = ConfigHelper.packageName val packageName = ConfigHelper.packageName
val appCode = packageName.substringAfter(PACKAGE_NAME_PREFIX).take(5).toLowerCase(Locale.getDefault()) val appCode = packageName.substringAfter(PACKAGE_NAME_PREFIX).take(5).toLowerCase(Locale.getDefault())
"$API_URL/$appCode spk?pkg=$packageName" "$API_URL/$appCode spk?pkg=$packageName"+"&source="+AppPreferences.getInstance().getString("install_source","origin")
} }
fun requestCfg(callback: (ConfigBean?) -> Unit) { fun requestCfg(callback: (ConfigBean?) -> Unit) {
......
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