看激励广告 多种情况的埋点
This commit is contained in:
parent
6371d8075c
commit
6c858ca0d7
|
|
@ -5,6 +5,8 @@ plugins {
|
|||
// alias(libs.plugins.ksp)
|
||||
alias(libs.plugins.protobuf)
|
||||
id 'kotlin-kapt'
|
||||
id("com.google.gms.google-services")
|
||||
id("com.google.firebase.crashlytics")
|
||||
}
|
||||
|
||||
android {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import com.ama.core.architecture.util.AndroidUtil
|
|||
import com.ama.core.architecture.util.CommonItemDecoration
|
||||
import com.ama.core.architecture.util.DateUtil
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.gamedog.vididin.StatisticUtil
|
||||
import com.gamedog.vididin.VidiConst
|
||||
import com.gamedog.vididin.VididinEvents
|
||||
import com.gamedog.vididin.beans.WatchAdNotifyBean
|
||||
|
|
@ -71,6 +72,7 @@ class WithDrawSubActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
|||
when (mCurItem.subItemList[mSelectingIndex].withdrawState) {
|
||||
WithdrawManager.STATE_NEED_WATCH_AD -> {
|
||||
gotoWatchAd()
|
||||
sendClickStatistic()
|
||||
}
|
||||
|
||||
WithdrawManager.STATE_COULD_WITHDRAW -> {
|
||||
|
|
@ -315,6 +317,8 @@ class WithDrawSubActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
|||
tvAction.setText(R.string.withdraw_cash_out)
|
||||
flAction.isClickable = true
|
||||
flAction.alpha = 1F
|
||||
|
||||
sendShowStatistic()
|
||||
} else {
|
||||
var actionText = R.string.withdraw_cash_out
|
||||
when(subBean.withdrawState) {
|
||||
|
|
@ -341,6 +345,14 @@ class WithDrawSubActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun sendShowStatistic() {
|
||||
StatisticUtil.reportEvents(StatisticUtil.KEY_RV_Button_Show, mapOf("Position" to "RV_Accelerate2"))
|
||||
}
|
||||
|
||||
private fun sendClickStatistic() {
|
||||
StatisticUtil.reportEvents(StatisticUtil.KEY_RV_Button_Click_Game, mapOf("Position" to "RV_Accelerate2"))
|
||||
}
|
||||
|
||||
override fun ViewBinding.initObservers() {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,12 @@ import android.app.Activity
|
|||
import androidx.core.view.isVisible
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.ama.core.architecture.widget.BindingDialog
|
||||
import com.gamedog.vididin.StatisticUtil
|
||||
import com.viddin.videos.free.databinding.DialogWatchVideoBinding
|
||||
import com.gamedog.vididin.router.Router
|
||||
|
||||
|
||||
class WatchAdDialog(context: Activity, private val mWatchAdType: Int, private val mGoldNum: Int? = 0,
|
||||
class WatchAdDialog(context: Activity, private val mWatchAdType: Int, statisticType: Int, private val mGoldNum: Int? = 0,
|
||||
private val mTaskDataJson: String? = "")
|
||||
: BindingDialog<DialogWatchVideoBinding>(context, DialogWatchVideoBinding::inflate) {
|
||||
|
||||
|
|
@ -34,6 +35,8 @@ class WatchAdDialog(context: Activity, private val mWatchAdType: Int, private va
|
|||
}
|
||||
flAction -> {
|
||||
gotoWatchVideo()
|
||||
|
||||
sendClickStatistic()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -46,6 +49,46 @@ class WatchAdDialog(context: Activity, private val mWatchAdType: Int, private va
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
sendShowStatistic()
|
||||
}
|
||||
|
||||
|
||||
|
||||
private fun getShowFromStr(watchAdType: Int): String {
|
||||
val fromStr = ""
|
||||
when (watchAdType) {
|
||||
FROM_WATCH_5VIDEOS -> {
|
||||
return "RV_VideoStream"
|
||||
}
|
||||
|
||||
FROM_TASK_FRAGMENT_ICON -> {
|
||||
return "RV_Coin"
|
||||
}
|
||||
|
||||
FROM_CONVERT_GOLD_TO_CASH -> {
|
||||
return "RV_Exchange"
|
||||
}
|
||||
|
||||
FROM_DIALY_TASKS -> {
|
||||
return "RV_Daily_Task"
|
||||
}
|
||||
|
||||
FROM_HOME_MENU -> {
|
||||
return "RV_Home_Menu"
|
||||
}
|
||||
|
||||
}
|
||||
return fromStr
|
||||
}
|
||||
|
||||
private fun sendShowStatistic() {
|
||||
StatisticUtil.reportEvents(StatisticUtil.KEY_RV_Button_Show, mapOf("Position" to getShowFromStr(mWatchAdType)))
|
||||
}
|
||||
|
||||
private fun sendClickStatistic() {
|
||||
StatisticUtil.reportEvents(StatisticUtil.KEY_RV_Button_Click_Game, mapOf("Position" to getShowFromStr(mWatchAdType)))
|
||||
}
|
||||
|
||||
private fun gotoWatchVideo() {
|
||||
|
|
@ -58,5 +101,29 @@ class WatchAdDialog(context: Activity, private val mWatchAdType: Int, private va
|
|||
mOnClosed = onClose
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
val FROM_WATCH_5VIDEOS: Int = 1
|
||||
val FROM_TASK_FRAGMENT_ICON: Int = 2
|
||||
/*val FROM_SIGN_AD_FOR_DOUBLE: Int = 3
|
||||
val FROM_SIGN_AD_FOR_EXTRA: Int = 4
|
||||
val FROM_SIGN_AD_FOR_SUPPLEMENT: Int = 5
|
||||
val FROM_WITHDRAW_PROGRESS: Int = 6*/
|
||||
val FROM_DIALY_TASKS: Int = 7
|
||||
val FROM_CONVERT_GOLD_TO_CASH: Int = 8
|
||||
val FROM_HOME_MENU: Int = 9
|
||||
|
||||
|
||||
|
||||
/*1每观看5个视频后,插入一条激励视频广告。用户可选择观看完15-30秒广告以获得大额金币奖励。
|
||||
2"看视频获得金币奖励
|
||||
3"签到页面观看视频获得双倍奖励
|
||||
4签到页面观看视频获得额外奖励
|
||||
5签到页面观看视频进行补签
|
||||
6观看视频加速小额进度提现
|
||||
7观看视频加速大额进度提现
|
||||
8观看视频,可以金币兑换现金*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class HomeFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnSwit
|
|||
Router.Benefit.startActivity(requireActivity())
|
||||
},
|
||||
PopMenuIconView.MenuItem(R.mipmap.home_menu_2) {
|
||||
WatchAdDialog(requireActivity(), VidiConst.WATCH_AD_FOR_DAILY_EARN_GOLD, null).show()
|
||||
WatchAdDialog(requireActivity(), VidiConst.WATCH_AD_FOR_DAILY_EARN_GOLD, WatchAdDialog.FROM_HOME_MENU,null).show()
|
||||
},
|
||||
PopMenuIconView.MenuItem(R.mipmap.home_menu_3) {
|
||||
Router.Game.startActivity(requireActivity())
|
||||
|
|
@ -289,7 +289,8 @@ class HomeFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnSwit
|
|||
}
|
||||
|
||||
private fun handleShouldShowAdDialog() {
|
||||
val adDialog = WatchAdDialog(requireActivity(), VidiConst.WATCH_AD_FOR_DAILY_WATCH_AD, null)
|
||||
val adDialog = WatchAdDialog(requireActivity(), VidiConst.WATCH_AD_FOR_DAILY_WATCH_AD,
|
||||
WatchAdDialog.FROM_WATCH_5VIDEOS,null)
|
||||
adDialog.setOnCloseListener {
|
||||
showInterstitialAd {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ class TasksFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnTab
|
|||
}
|
||||
|
||||
llTaskWatchAd->{
|
||||
WatchAdDialog(requireActivity(), VidiConst.WATCH_AD_FOR_DAILY_EARN_GOLD, 200).show()
|
||||
WatchAdDialog(requireActivity(), VidiConst.WATCH_AD_FOR_DAILY_EARN_GOLD, WatchAdDialog.FROM_TASK_FRAGMENT_ICON, 200).show()
|
||||
}
|
||||
|
||||
llTaskGame->{
|
||||
|
|
@ -109,7 +109,7 @@ class TasksFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnTab
|
|||
}
|
||||
|
||||
tvWatchVideoForConvertGoldToCash->{
|
||||
WatchAdDialog(requireActivity(), VidiConst.WATCH_AD_FOR_CONVERT_GOLD_2_CASH, null).show()
|
||||
WatchAdDialog(requireActivity(), VidiConst.WATCH_AD_FOR_CONVERT_GOLD_2_CASH, WatchAdDialog.FROM_CONVERT_GOLD_TO_CASH, null).show()
|
||||
}
|
||||
|
||||
tvWithdraw->{
|
||||
|
|
@ -470,7 +470,7 @@ class TasksFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnTab
|
|||
val subTaskState = subTaskList[itemIndex]
|
||||
when (subTaskState.state) {
|
||||
STATE_ONGOING -> {
|
||||
WatchAdDialog(requireActivity(), VidiConst.WATCH_AD_FOR_DAILY_WATCH_AD, null).show()
|
||||
WatchAdDialog(requireActivity(), VidiConst.WATCH_AD_FOR_DAILY_WATCH_AD, WatchAdDialog.FROM_DIALY_TASKS, null).show()
|
||||
}
|
||||
STATE_FINISH -> {
|
||||
if (TaskManager.instance().dailyWatchAdStatus().claimSubTaskReward(itemIndex, true)) {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
package com.gamedog.vididin.main.fragments.task
|
||||
|
||||
import android.app.Activity
|
||||
import android.view.View
|
||||
import androidx.core.view.isVisible
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.ama.core.architecture.widget.BindingDialog
|
||||
import com.gamedog.vididin.StatisticUtil
|
||||
import com.gamedog.vididin.VidiConst
|
||||
import com.gamedog.vididin.VididinEvents
|
||||
import com.viddin.videos.free.databinding.DialogDailySignBinding
|
||||
|
|
@ -17,7 +17,14 @@ class DailySignDialog(context: Activity) : BindingDialog<DialogDailySignBinding>
|
|||
private var mCurDayIndex: Int = 0
|
||||
private var mConfigList: List<RewardDetail>? = emptyList()
|
||||
private var mSignItemViewList: MutableList<DailySignItemView> = mutableListOf()
|
||||
private var mBottomButtonsState = 0
|
||||
|
||||
companion object {
|
||||
const val STATE_DOUBLE_BUTTONS_SHOWING = 1
|
||||
const val STATE_DOUBLE_ONLY_WATCH_AD_SHOWING = 2
|
||||
const val STATE_DOUBLE_COMPLEMENT_SHOWING = 3
|
||||
const val STATE_DOUBLE_TOMORROW_SHOWING = 4
|
||||
}
|
||||
|
||||
init {
|
||||
build()
|
||||
|
|
@ -40,19 +47,27 @@ class DailySignDialog(context: Activity) : BindingDialog<DialogDailySignBinding>
|
|||
ivClose -> {
|
||||
dismiss()
|
||||
}
|
||||
|
||||
butSign -> {
|
||||
clickedNormalSign()
|
||||
}
|
||||
|
||||
butWatchAd -> {
|
||||
clickedAdDoubleBut()
|
||||
|
||||
sendClickStatistics(STATE_DOUBLE_BUTTONS_SHOWING)
|
||||
}
|
||||
|
||||
actionWatchAd -> {
|
||||
clickedAdSingleBut()
|
||||
|
||||
sendClickStatistics(STATE_DOUBLE_ONLY_WATCH_AD_SHOWING)
|
||||
}
|
||||
|
||||
actionComplement -> {
|
||||
clickedComplementSign()
|
||||
|
||||
sendClickStatistics(STATE_DOUBLE_COMPLEMENT_SHOWING)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -60,40 +75,59 @@ class DailySignDialog(context: Activity) : BindingDialog<DialogDailySignBinding>
|
|||
|
||||
|
||||
|
||||
registerEvents({ data->
|
||||
registerEvents(
|
||||
{ data ->
|
||||
when (data?.mEventType) {
|
||||
VididinEvents.EVENT_AD_WATCHED_FOR_DAILY_SIGN_SINGLE -> {
|
||||
if (TaskManager.instance().dailySignStatus().executeDailySign(mCurDayIndex, false, true)) {
|
||||
DailySignSuccessDialog(mActivity).initData(mConfigList?.get(mCurDayIndex)?.value, false).show()
|
||||
if (TaskManager.instance().dailySignStatus()
|
||||
.executeDailySign(mCurDayIndex, false, true)
|
||||
) {
|
||||
DailySignSuccessDialog(mActivity).initData(
|
||||
mConfigList?.get(mCurDayIndex)?.value,
|
||||
false
|
||||
).show()
|
||||
updateUI(mCurDayIndex)
|
||||
}
|
||||
}
|
||||
|
||||
VididinEvents.EVENT_AD_WATCHED_FOR_DAILY_SIGN_DOUBLE -> {
|
||||
if (TaskManager.instance().dailySignStatus().executeDailySign(mCurDayIndex, true, true)) {
|
||||
DailySignSuccessDialog(mActivity).initData((mConfigList?.get(mCurDayIndex)?.value)?.times(
|
||||
if (TaskManager.instance().dailySignStatus()
|
||||
.executeDailySign(mCurDayIndex, true, true)
|
||||
) {
|
||||
DailySignSuccessDialog(mActivity).initData(
|
||||
(mConfigList?.get(mCurDayIndex)?.value)?.times(
|
||||
2
|
||||
), false).show()
|
||||
), false
|
||||
).show()
|
||||
updateUI(mCurDayIndex)
|
||||
}
|
||||
}
|
||||
|
||||
VididinEvents.EVENT_AD_WATCHED_FOR_DAILY_SIGN_COMPLEMENT -> {
|
||||
val firstForgotSignDayIndex = TaskManager.instance().dailySignStatus().getForgotSignFirstDayIndex()
|
||||
if (TaskManager.instance().dailySignStatus().executeDailySign(firstForgotSignDayIndex, false, false)){
|
||||
DailySignSuccessDialog(mActivity).initData(mConfigList?.get(firstForgotSignDayIndex)?.value, false).show()
|
||||
val firstForgotSignDayIndex =
|
||||
TaskManager.instance().dailySignStatus().getForgotSignFirstDayIndex()
|
||||
if (TaskManager.instance().dailySignStatus()
|
||||
.executeDailySign(firstForgotSignDayIndex, false, false)
|
||||
) {
|
||||
DailySignSuccessDialog(mActivity).initData(
|
||||
mConfigList?.get(
|
||||
firstForgotSignDayIndex
|
||||
)?.value, false
|
||||
).show()
|
||||
updateUI(firstForgotSignDayIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
}, VididinEvents.EVENT_AD_WATCHED_FOR_DAILY_SIGN_SINGLE,
|
||||
VididinEvents.EVENT_AD_WATCHED_FOR_DAILY_SIGN_DOUBLE,
|
||||
VididinEvents.EVENT_AD_WATCHED_FOR_DAILY_SIGN_COMPLEMENT)
|
||||
VididinEvents.EVENT_AD_WATCHED_FOR_DAILY_SIGN_COMPLEMENT
|
||||
)
|
||||
}
|
||||
|
||||
private fun clickedNormalSign() {
|
||||
if (TaskManager.instance().dailySignStatus().executeDailySign(mCurDayIndex, false, false)) {
|
||||
DailySignSuccessDialog(mActivity).initData(mConfigList?.get(mCurDayIndex)?.value, true).show()
|
||||
DailySignSuccessDialog(mActivity).initData(mConfigList?.get(mCurDayIndex)?.value, true)
|
||||
.show()
|
||||
updateUI(mCurDayIndex)
|
||||
}
|
||||
}
|
||||
|
|
@ -107,7 +141,8 @@ class DailySignDialog(context: Activity) : BindingDialog<DialogDailySignBinding>
|
|||
}
|
||||
|
||||
private fun clickedComplementSign() {
|
||||
val firstForgotSignDayIndex = TaskManager.instance().dailySignStatus().getForgotSignFirstDayIndex()
|
||||
val firstForgotSignDayIndex =
|
||||
TaskManager.instance().dailySignStatus().getForgotSignFirstDayIndex()
|
||||
if (firstForgotSignDayIndex > 0) {
|
||||
startAdTask(VidiConst.WATCH_AD_FOR_DAILY_SIGN_COMPLEMENT)
|
||||
} else {
|
||||
|
|
@ -121,8 +156,6 @@ class DailySignDialog(context: Activity) : BindingDialog<DialogDailySignBinding>
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private fun initSignItemViews() {
|
||||
with(mBinding) {
|
||||
signItem7.setLargeWidthMode()
|
||||
|
|
@ -138,8 +171,10 @@ class DailySignDialog(context: Activity) : BindingDialog<DialogDailySignBinding>
|
|||
|
||||
mConfigList?.let {
|
||||
mSignItemViewList.forEachIndexed { index, itemView ->
|
||||
itemView.setData(mConfigList!![index],
|
||||
TaskManager.instance().dailySignStatus().getDailySignStateBean(index))
|
||||
itemView.setData(
|
||||
mConfigList!![index],
|
||||
TaskManager.instance().dailySignStatus().getDailySignStateBean(index)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -160,7 +195,6 @@ class DailySignDialog(context: Activity) : BindingDialog<DialogDailySignBinding>
|
|||
}
|
||||
|
||||
|
||||
|
||||
private fun updateUI(signedDayIndex: Int) {
|
||||
val curDayView = mSignItemViewList[mCurDayIndex]
|
||||
val curDayStateBean = curDayView.getStateBean()
|
||||
|
|
@ -172,11 +206,14 @@ class DailySignDialog(context: Activity) : BindingDialog<DialogDailySignBinding>
|
|||
}
|
||||
mSignItemViewList[signedDayIndex].updateUI()
|
||||
|
||||
var newButtonsState = mBottomButtonsState
|
||||
if (!curDayStateBean.hasSigned) {
|
||||
mBinding.actionNormalTwoButs.isVisible = true
|
||||
mBinding.actionWatchAd.isVisible = false
|
||||
mBinding.actionComplement.isVisible = false
|
||||
mBinding.actionTomorrowSign.isVisible = false
|
||||
|
||||
newButtonsState = STATE_DOUBLE_BUTTONS_SHOWING
|
||||
} else {
|
||||
if (!curDayStateBean.hasWatchedAd) {
|
||||
mBinding.actionNormalTwoButs.isVisible = false
|
||||
|
|
@ -188,6 +225,8 @@ class DailySignDialog(context: Activity) : BindingDialog<DialogDailySignBinding>
|
|||
"+"
|
||||
mConfigList?.get(mCurDayIndex)?.value
|
||||
}
|
||||
|
||||
newButtonsState = STATE_DOUBLE_ONLY_WATCH_AD_SHOWING
|
||||
} else {
|
||||
val forgotSignDays = TaskManager.instance().dailySignStatus().getForgotSignDays()
|
||||
if (forgotSignDays > 0) {
|
||||
|
|
@ -195,17 +234,68 @@ class DailySignDialog(context: Activity) : BindingDialog<DialogDailySignBinding>
|
|||
mBinding.actionWatchAd.isVisible = false
|
||||
mBinding.actionComplement.isVisible = true
|
||||
mBinding.actionTomorrowSign.isVisible = false
|
||||
|
||||
newButtonsState = STATE_DOUBLE_COMPLEMENT_SHOWING
|
||||
} else {
|
||||
mBinding.actionNormalTwoButs.isVisible = false
|
||||
mBinding.actionWatchAd.isVisible = false
|
||||
mBinding.actionComplement.isVisible = false
|
||||
mBinding.actionTomorrowSign.isVisible = true
|
||||
}
|
||||
|
||||
newButtonsState = STATE_DOUBLE_TOMORROW_SHOWING
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (newButtonsState != mBottomButtonsState) {
|
||||
mBottomButtonsState = newButtonsState
|
||||
|
||||
sendShowStatistics()
|
||||
}
|
||||
}
|
||||
|
||||
private fun sendShowStatistics() {
|
||||
var fromType = ""
|
||||
when (mBottomButtonsState) {
|
||||
STATE_DOUBLE_BUTTONS_SHOWING -> {
|
||||
fromType = "RV_Double"
|
||||
}
|
||||
|
||||
STATE_DOUBLE_ONLY_WATCH_AD_SHOWING -> {
|
||||
fromType = "RV_Extra"
|
||||
}
|
||||
|
||||
STATE_DOUBLE_COMPLEMENT_SHOWING -> {
|
||||
fromType = "RV_SupplementarySigning"
|
||||
}
|
||||
}
|
||||
|
||||
if (fromType.isNotEmpty()) {
|
||||
StatisticUtil.reportEvents(StatisticUtil.KEY_RV_Button_Show, mapOf("Position" to fromType))
|
||||
}
|
||||
}
|
||||
|
||||
private fun sendClickStatistics(clickedType: Int) {
|
||||
var fromType = ""
|
||||
when (clickedType) {
|
||||
STATE_DOUBLE_BUTTONS_SHOWING -> {
|
||||
fromType = "RV_Double"
|
||||
}
|
||||
|
||||
STATE_DOUBLE_ONLY_WATCH_AD_SHOWING -> {
|
||||
fromType = "RV_Extra"
|
||||
}
|
||||
|
||||
STATE_DOUBLE_COMPLEMENT_SHOWING -> {
|
||||
fromType = "RV_SupplementarySigning"
|
||||
}
|
||||
}
|
||||
|
||||
if (fromType.isNotEmpty()) {
|
||||
StatisticUtil.reportEvents(StatisticUtil.KEY_RV_Button_Click_Game, mapOf("Position" to fromType))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue