数数 公共super参数
This commit is contained in:
parent
0fc80a387e
commit
5ebb3153b8
|
|
@ -1,5 +1,6 @@
|
||||||
package com.gamedog.statisticreporter
|
package com.gamedog.statisticreporter
|
||||||
|
|
||||||
|
import com.gamedog.statisticreporter.adjust.AdjustManager
|
||||||
import com.gamedog.statisticreporter.firbase.FireBaseManager
|
import com.gamedog.statisticreporter.firbase.FireBaseManager
|
||||||
import com.gamedog.statisticreporter.shushu.ShushuManager
|
import com.gamedog.statisticreporter.shushu.ShushuManager
|
||||||
import com.remax.base.report.DataReportManager
|
import com.remax.base.report.DataReportManager
|
||||||
|
|
@ -9,9 +10,14 @@ import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.SupervisorJob
|
import kotlinx.coroutines.SupervisorJob
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import org.json.JSONObject
|
||||||
|
|
||||||
object StatisticUtil {
|
object StatisticUtil {
|
||||||
|
|
||||||
|
private lateinit var mGoldTimesFun: () -> Int
|
||||||
|
private lateinit var mCashTimesFun: () -> Int
|
||||||
|
private lateinit var mGoldFun: () -> Long
|
||||||
|
private lateinit var mCashFun: () -> Double
|
||||||
private val mBgScope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
|
private val mBgScope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
|
||||||
|
|
||||||
const val KEY_Loading_Start: String = "Loading_Start"
|
const val KEY_Loading_Start: String = "Loading_Start"
|
||||||
|
|
@ -56,6 +62,14 @@ object StatisticUtil {
|
||||||
|
|
||||||
fun reportEvents(eventKey: String, eventData: Map<String, Any>? = null) {
|
fun reportEvents(eventKey: String, eventData: Map<String, Any>? = null) {
|
||||||
mBgScope.launch {
|
mBgScope.launch {
|
||||||
|
val superProperties = JSONObject().apply {
|
||||||
|
put("Money_Num", mCashFun.invoke())
|
||||||
|
put("Coin_Num", mGoldFun.invoke())
|
||||||
|
put("RV_Times_Coins", mGoldTimesFun.invoke())
|
||||||
|
put("RV_Times_Money", mCashTimesFun.invoke())
|
||||||
|
put("ad_network", AdjustManager.instance().getNetwork())
|
||||||
|
}
|
||||||
|
|
||||||
FireBaseManager.instance().reportEvent(eventKey, eventData)
|
FireBaseManager.instance().reportEvent(eventKey, eventData)
|
||||||
ShushuManager.instance().reportEvent(eventKey, eventData)
|
ShushuManager.instance().reportEvent(eventKey, eventData)
|
||||||
|
|
||||||
|
|
@ -96,6 +110,14 @@ object StatisticUtil {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun initCallbacks(cashCallback: ()->Double, goldCallback: ()->Long,
|
||||||
|
cashTimesCallback: ()->Int, goldTimesCallback: ()->Int) {
|
||||||
|
mCashFun = cashCallback
|
||||||
|
mGoldFun = goldCallback
|
||||||
|
mCashTimesFun = cashTimesCallback
|
||||||
|
mGoldTimesFun = goldTimesCallback
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ class AdjustManager private constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private var mAttribution: AdjustAttribution? = null
|
||||||
private var initStartTime: Long = 0
|
private var initStartTime: Long = 0
|
||||||
|
|
||||||
private var mAdjustInitStartMs: Long = 0
|
private var mAdjustInitStartMs: Long = 0
|
||||||
|
|
@ -59,6 +60,7 @@ class AdjustManager private constructor() {
|
||||||
run {
|
run {
|
||||||
// 所有用户一开始都是自然用户的状态,需要通过调用setOnAttributionChangedListener这个方法(这个方法就是返回用户改变后的状态),获得买量来源信息
|
// 所有用户一开始都是自然用户的状态,需要通过调用setOnAttributionChangedListener这个方法(这个方法就是返回用户改变后的状态),获得买量来源信息
|
||||||
Adjust.getAttribution { attribution ->
|
Adjust.getAttribution { attribution ->
|
||||||
|
mAttribution = attribution
|
||||||
val networkFrom = attribution.network
|
val networkFrom = attribution.network
|
||||||
var userTypeInt = 0
|
var userTypeInt = 0
|
||||||
if (!TextUtils.isEmpty(networkFrom)) {
|
if (!TextUtils.isEmpty(networkFrom)) {
|
||||||
|
|
@ -151,6 +153,8 @@ class AdjustManager private constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleAttribution(attr: AdjustAttribution) {
|
private fun handleAttribution(attr: AdjustAttribution) {
|
||||||
|
mAttribution = attr
|
||||||
|
|
||||||
// 设置公共参数,并限制长度
|
// 设置公共参数,并限制长度
|
||||||
CommonParamsManager.adNetwork = (attr.network ?: "").take(10)
|
CommonParamsManager.adNetwork = (attr.network ?: "").take(10)
|
||||||
CommonParamsManager.campaign = (attr.campaign ?: "").take(20)
|
CommonParamsManager.campaign = (attr.campaign ?: "").take(20)
|
||||||
|
|
@ -265,6 +269,9 @@ class AdjustManager private constructor() {
|
||||||
return if (randomInt <= 2) "ironsource_sdk" else "applovin_max_sdk"
|
return if (randomInt <= 2) "ironsource_sdk" else "applovin_max_sdk"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getNetwork(): String {
|
||||||
|
return mAttribution?.network ?: ""
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ data class Account(
|
||||||
var diamondCount: Int = 0,
|
var diamondCount: Int = 0,
|
||||||
var bankInfo: BankInfo? = null,
|
var bankInfo: BankInfo? = null,
|
||||||
val zeroBuyServerSecret: String = "",
|
val zeroBuyServerSecret: String = "",
|
||||||
|
var rvTimesGold: Int = 0,
|
||||||
|
var rvTimesCash: Int = 0,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.viddin.videos.free
|
package com.viddin.videos.free
|
||||||
|
|
||||||
import com.ama.core.architecture.BaseApp
|
import com.ama.core.architecture.BaseApp
|
||||||
|
import com.gamedog.statisticreporter.StatisticUtil
|
||||||
import com.gamedog.statisticreporter.adjust.AdjustManager
|
import com.gamedog.statisticreporter.adjust.AdjustManager
|
||||||
import com.gamedog.statisticreporter.firbase.FireBaseManager
|
import com.gamedog.statisticreporter.firbase.FireBaseManager
|
||||||
import com.gamedog.statisticreporter.shushu.ShushuManager
|
import com.gamedog.statisticreporter.shushu.ShushuManager
|
||||||
|
|
@ -26,5 +27,15 @@ class VidiDinApp : BaseApp() {
|
||||||
ShushuManager.Companion.instance().initShushu(VidiConst.SHUSHU_APP_ID, VidiConst.SHUSHU_SERVER_URL)
|
ShushuManager.Companion.instance().initShushu(VidiConst.SHUSHU_APP_ID, VidiConst.SHUSHU_SERVER_URL)
|
||||||
FireBaseManager.Companion.instance()
|
FireBaseManager.Companion.instance()
|
||||||
AdjustManager.Companion.instance().initSdk(VidiConst.ADJUST_TOKEN)
|
AdjustManager.Companion.instance().initSdk(VidiConst.ADJUST_TOKEN)
|
||||||
|
|
||||||
|
StatisticUtil.initCallbacks( {
|
||||||
|
AccountManager.getCash()
|
||||||
|
}, {
|
||||||
|
AccountManager.getGold()
|
||||||
|
}, {
|
||||||
|
1
|
||||||
|
}, {
|
||||||
|
1
|
||||||
|
} )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue