Commit 18372f31 authored by 王雪伟's avatar 王雪伟

[提交人]:王雪伟

[提交简述] :加入上报事件戳
[实现方案] :
parent e3d59db6
...@@ -48,7 +48,7 @@ class Appli : Application() { ...@@ -48,7 +48,7 @@ class Appli : Application() {
val afDevKey = "bbVuECGrv5oci77w97NMVg" val afDevKey = "bbVuECGrv5oci77w97NMVg"
val appsflyer: AppsFlyerLib = AppsFlyerLib.getInstance() val appsflyer: AppsFlyerLib = AppsFlyerLib.getInstance()
// For debug - remove in production // For debug - remove in production
appsflyer.setDebugLog(true) appsflyer.setDebugLog(false)
//optional //optional
appsflyer.setMinTimeBetweenSessions(0) appsflyer.setMinTimeBetweenSessions(0)
appsflyer.init(afDevKey, null, this) appsflyer.init(afDevKey, null, this)
......
PACKAGE_NAME=com.zhangxin.magicbox PACKAGE_NAME=com.zhangxin.magicbox
VERSION_CODE=13 VERSION_CODE=14
VERSION_NAME=1.0.3.5 VERSION_NAME=1.0.3.6
\ No newline at end of file \ No newline at end of file
...@@ -282,7 +282,6 @@ class PayActivity : BaseActivity(), PayContract.View, ...@@ -282,7 +282,6 @@ class PayActivity : BaseActivity(), PayContract.View,
EventUtils.onEvent("pay_fail") EventUtils.onEvent("pay_fail")
mLoading?.setResult(false, "Pay for failure", 1000) mLoading?.setResult(false, "Pay for failure", 1000)
} }
} }
fun setBootmPrice() { fun setBootmPrice() {
...@@ -516,15 +515,18 @@ class PayActivity : BaseActivity(), PayContract.View, ...@@ -516,15 +515,18 @@ class PayActivity : BaseActivity(), PayContract.View,
var googlePay: GooglePayHelper? = null var googlePay: GooglePayHelper? = null
private fun googlePay(goodsId: String) { private fun googlePay(goodsId: String) {
if (goodsId == "") { if (goodsId == "") {
EventUtils.onEvent("GooglePayGoodsIdNull")
return return
} }
mLoading?.setLoading(getString(R.string.wait_ing2)) mLoading?.setLoading(getString(R.string.wait_ing2))
mLoading?.show() mLoading?.show()
EventUtils.onEvent("GooglePayStart", "开始支付")
googlePay?.googlePay(goodsId, "6", object : GooglePayCallBack { googlePay?.googlePay(goodsId, "6", object : GooglePayCallBack {
override fun onPaySuccess(purchase: GooglePayResult, googleJson: String) { override fun onPaySuccess(purchase: GooglePayResult, googleJson: String) {
mPresenter?.verifyPay(googleJson, GOOGLE_PAY) mPresenter?.verifyPay(googleJson, GOOGLE_PAY)
//mLoading?.setResult(true, "Pay for success", 1000) //mLoading?.setResult(true, "Pay for success", 1000)
EventUtils.onEvent("GooglePaySuccess") EventUtils.onEvent("GooglePaySuccess")
EventUtils.onEvent("GooglePayEnd", "支付结束_成功")
} }
override fun onCancel() { override fun onCancel() {
...@@ -532,6 +534,7 @@ class PayActivity : BaseActivity(), PayContract.View, ...@@ -532,6 +534,7 @@ class PayActivity : BaseActivity(), PayContract.View,
mLoading?.setResult(false, "pay cancel", 1000) mLoading?.setResult(false, "pay cancel", 1000)
} }
EventUtils.onEvent("GooglePayCancel") EventUtils.onEvent("GooglePayCancel")
EventUtils.onEvent("GooglePayEnd", "支付结束_取消")
} }
override fun onError(error: String) { override fun onError(error: String) {
...@@ -540,6 +543,8 @@ class PayActivity : BaseActivity(), PayContract.View, ...@@ -540,6 +543,8 @@ class PayActivity : BaseActivity(), PayContract.View,
mLoading?.setResult(false, "pay error", 1000) mLoading?.setResult(false, "pay error", 1000)
} }
EventUtils.onEvent("GooglePayError", error) EventUtils.onEvent("GooglePayError", error)
EventUtils.onEvent("GooglePayEnd", "支付结束_异常 msg:${error}")
} }
}) })
} }
......
...@@ -39,20 +39,21 @@ object EventUtils { ...@@ -39,20 +39,21 @@ object EventUtils {
fun onEvent(action: String) { fun onEvent(action: String) {
val jsonObj = getJSON(action) val jsonObj = getJSON(action)
jsonObj.put("time", "${System.currentTimeMillis()}")
apiClient(jsonObj) apiClient(jsonObj)
appFlayerEvent(action,"") appFlayerEvent(action,jsonObj)
// MobclickAgent.onEvent(AppContext.get(), action) // MobclickAgent.onEvent(AppContext.get(), action)
} }
fun onEvent(action: String, value: String) { fun onEvent(action: String, value: String) {
val jsonObj = getJSON(action) val jsonObj = getJSON(action)
jsonObj.put("value", value) jsonObj.put("value", value)
jsonObj.put("time", "${System.currentTimeMillis()}")
apiClient(jsonObj) apiClient(jsonObj)
appFlayerEvent(action,value) appFlayerEvent(action,jsonObj)
// MobclickAgent.onEvent(AppContext.get(), action, value) // MobclickAgent.onEvent(AppContext.get(), action, value)
} }
// /** // /**
// * 统计新用户首次登陆 男女生 // * 统计新用户首次登陆 男女生
// */ // */
...@@ -73,9 +74,9 @@ object EventUtils { ...@@ -73,9 +74,9 @@ object EventUtils {
private fun apiClient(data: JSONObject) { private fun apiClient(data: JSONObject) {
val str = data.toString() val str = data.toString()
Log.d("EventUtils", str) // Log.d("EventUtils", str)
val key = AESUtils.encrypt(str) val key = AESUtils.encrypt(str)
Log.d("EventUtils", key) // Log.d("EventUtils", key)
EventApiClient.cfgApi.requestEvent("behavior", key).subscribeOn(Schedulers.io()) EventApiClient.cfgApi.requestEvent("behavior", key).subscribeOn(Schedulers.io())
.subscribe(object : Observer<Any> { .subscribe(object : Observer<Any> {
override fun onComplete() { override fun onComplete() {
...@@ -117,9 +118,9 @@ object EventUtils { ...@@ -117,9 +118,9 @@ object EventUtils {
} }
fun appFlayerEvent(action: String, value: String) { fun appFlayerEvent(action: String,data: JSONObject) {
var eventValues = HashMap<String, Any>() var eventValues = HashMap<String, Any>()
eventValues[action] = value eventValues[action] = data.toString()
AppsFlyerLib.getInstance().logEvent(AppContext.get(), action, eventValues,object :AppsFlyerRequestListener{ AppsFlyerLib.getInstance().logEvent(AppContext.get(), action, eventValues,object :AppsFlyerRequestListener{
override fun onSuccess() { override fun onSuccess() {
Log.e("appsflyer","onSuccess") Log.e("appsflyer","onSuccess")
......
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