【埋点】Chest_Claim_Click(宝箱领取点击事件)在可以领取时就上报了,需要点击领取后上报。且事件中total_amount 属性上报错误,领取 0.1 奖励上报为 1
This commit is contained in:
parent
91260dc651
commit
479e8aad93
|
|
@ -58,7 +58,6 @@ class BoxTaskHelper: BaseTaskHelper<TaskStateBoxRoot, BoxTaskRoot>() {
|
|||
if (taskStateBeanInSp == null || taskStateBeanInSp.boxList.isNullOrEmpty() || isAllBoxExpiredOrFinished(taskStateBeanInSp)) {
|
||||
mStateBean = generateStateBeanFromConfig()
|
||||
saveState2Sp()
|
||||
sendEnterNewSubBoxEvent(0)
|
||||
} else {
|
||||
mStateBean = taskStateBeanInSp
|
||||
calculateCurrentOngoingBox()
|
||||
|
|
@ -112,8 +111,6 @@ class BoxTaskHelper: BaseTaskHelper<TaskStateBoxRoot, BoxTaskRoot>() {
|
|||
mStateBean.boxList[index].boxStartMs = DateUtil.getCurTimeMs()
|
||||
saveState2Sp()
|
||||
notifyEvent()
|
||||
|
||||
sendEnterNewSubBoxEvent(index)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
@ -121,14 +118,9 @@ class BoxTaskHelper: BaseTaskHelper<TaskStateBoxRoot, BoxTaskRoot>() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun sendEnterNewSubBoxEvent(index: Int) {
|
||||
val subBox = getBoxState(index)
|
||||
|
||||
subBox?.let {
|
||||
val resetBoxCount = mStateBean.boxList.size - index - 1
|
||||
private fun sendClaimedEvent(claimBoxTotal: Int, couldClaimCashNum: Double) {
|
||||
StatisticUtil.reportEvents(StatisticUtil.KEY_Chest_Claim_Click,
|
||||
mapOf("total_amount" to it.reward_value, "chest_count" to resetBoxCount, "task_type" to "subBox", "task_progress" to "0"))
|
||||
}
|
||||
mapOf("total_amount" to couldClaimCashNum, "chest_count" to claimBoxTotal))
|
||||
}
|
||||
|
||||
private fun sendSubBoxSubTaskFinishEvent(index: Int, subTask: TaskStateBoxSub) {
|
||||
|
|
@ -272,6 +264,16 @@ class BoxTaskHelper: BaseTaskHelper<TaskStateBoxRoot, BoxTaskRoot>() {
|
|||
return waitClaimCashNum
|
||||
}
|
||||
|
||||
fun getCouldClaimBoxNum(): Int {
|
||||
var subBoxNum = 0
|
||||
mStateBean.boxList.forEachIndexed { index, box ->
|
||||
if (getBoxStateEnum(index) == STATE_FINISH) {
|
||||
subBoxNum ++
|
||||
}
|
||||
}
|
||||
return subBoxNum
|
||||
}
|
||||
|
||||
fun getSubTaskHintStrRes(boxIndex: Int, subTaskIndex: Int): Int {
|
||||
when (boxIndex) {
|
||||
0-> {
|
||||
|
|
@ -350,6 +352,7 @@ class BoxTaskHelper: BaseTaskHelper<TaskStateBoxRoot, BoxTaskRoot>() {
|
|||
fun executeClaimCash(): Boolean {
|
||||
try {
|
||||
val couldClaimCashNum = getCouldClaimCashNum()
|
||||
val subBoxNum = getCouldClaimBoxNum()
|
||||
if (couldClaimCashNum > 0F) {
|
||||
AccountManager.adjustCash(couldClaimCashNum, RecordCash(RECORD_CASH_PLUS_BOX_TASK, couldClaimCashNum.toDouble()))
|
||||
mStateBean.boxList.forEachIndexed { index, box ->
|
||||
|
|
@ -357,6 +360,8 @@ class BoxTaskHelper: BaseTaskHelper<TaskStateBoxRoot, BoxTaskRoot>() {
|
|||
box.hasClaimedReward = true
|
||||
}
|
||||
}
|
||||
|
||||
sendClaimedEvent(subBoxNum, couldClaimCashNum)
|
||||
saveState2Sp()
|
||||
notifyEvent()
|
||||
return true
|
||||
|
|
|
|||
Loading…
Reference in New Issue