Commit dcf4b919 authored by mengcuiguang's avatar mengcuiguang

珊瑚loginkey添加json

parent c00e92b1
......@@ -262,7 +262,7 @@ dependencies {
// 微转阅读
implementation(name: 'articlesdk-v1.0.6.202012121917-x', ext: 'aar')
//天卓SDK的珊瑚2.0组件
implementation("com.android.support:support-v4:28.+")
// implementation("com.android.support:support-v4:28.+")
implementation(name: 'adapt-1.3.3', ext: 'aar')
implementation(name: 'commonbase-1.0.2', ext: 'aar')
implementation(name: 'discovery-2.0.14', ext: 'aar')
......
package com.mints.goodmoney.ad.video
import android.app.Activity
import android.text.TextUtils
import androidx.annotation.Nullable
import com.mints.goodmoney.BuildConfig
import com.mints.goodmoney.common.AppConfig
......@@ -10,12 +11,15 @@ import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.mvp.presenters.TzVideoAdPresenter
import com.mints.goodmoney.mvp.views.VideoAdManagerView
import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.MD5
import com.mints.library.utils.json.JsonUtil
import com.tz.sdk.coral.ad.CoralAD
import com.tz.sdk.coral.callback.CoralVideoListener
import com.tz.sdk.core.ad.ADError
import com.tz.sdk.core.ad.ADSource
import com.tz.sdk.core.ad.ADType
import com.tz.sdk.core.loader.ADLoader
import net.grandcentrix.tray.AppPreferences
private val TAG = ShVideoAdManager::class.java.simpleName
......@@ -29,6 +33,7 @@ class ShVideoAdManager private constructor(activity: Activity) :
private var tzVideoAdPresenter: TzVideoAdPresenter? = null
private var shVideoAdListener: ShVideoAdListener? = null
private lateinit var ps: AppPreferences
companion object {
......@@ -57,6 +62,7 @@ class ShVideoAdManager private constructor(activity: Activity) :
private fun init(activity: Activity) {
this.activity = activity
ps = AppPreferences(activity)
tzVideoAdPresenter = TzVideoAdPresenter()
tzVideoAdPresenter?.attachView(this)
}
......@@ -80,7 +86,7 @@ class ShVideoAdManager private constructor(activity: Activity) :
init {
put(CoralAD.Key.TASK_TYPE, type)
put(CoralAD.Key.ACCOUNT_ID, UserManager.getInstance().userID)
put(CoralAD.Key.LOGIN_KEY, UserManager.getInstance().tokenID)
put(CoralAD.Key.LOGIN_KEY, JsonUtil.toJson(getAdMapVO(curCoin, carrierType, extraId)))
// put(CoralAD.Key.VIDEO_AUTO_PLAY, true) //拉取成功后是否自动播放视频,非必须,默认true
}
})
......@@ -193,8 +199,25 @@ class ShVideoAdManager private constructor(activity: Activity) :
it.dispose()
it.detachView()
}
activity = null
}
private fun getAdMapVO(curCoin: Int, carrierType: String, extraId: String?): HashMap<String, Any> {
val vo = HashMap<String, Any>()
vo["carrierType"] = carrierType
vo["adtype"] = Constant.ADTYPE_VEDIO
vo["tid"] = MD5.GetMD5Code(System.currentTimeMillis().toString() + UserManager.getInstance().userID)
vo["adsource"] = Constant.AD_SOURCE_SH
vo["ip"] = ps.getString(Constant.CSJ_VEDIO_APPIP, "")!!
when (carrierType) {
Constant.CARRIER_VERSUS_VIDEO -> vo["coin"] = curCoin
Constant.CARRIER_HOMEWATER -> vo["waterCoin"] = curCoin
Constant.CARRIER_OFFLINE_DOUBLE -> {
vo["offline_income"] = curCoin
vo["turntableKey"] = if (TextUtils.isEmpty(extraId)) "" else extraId!!
}
Constant.CARRIER_CHALLENGE_TURN, Constant.CARRIER_CHALLENGE_CARD -> vo["turntableKey"] = if (TextUtils.isEmpty(extraId)) "" else extraId!!
}
return vo
}
}
\ No newline at end of file
......@@ -139,7 +139,7 @@ object Constant {
const val AD_SOURCE_SDHZ = "SDHZ" //闪电盒子
const val AD_SOURCE_FL = "FL" //枫岚
const val AD_SOURCE_CSJFULL = "CSJFULL"
const val AD_SOURCE_SH = "SH" //天卓
const val AD_SOURCE_SH = "CORAL" //天卓
// 调用事件 0 成功 1失败 2点击 3-有效展示 4-去重
const val EVENT_TYPE_ZERO = "0"
......
......@@ -13,7 +13,6 @@ import androidx.core.content.ContextCompat
import cn.sharesdk.framework.ShareSDK
import cn.sharesdk.wechat.friends.Wechat
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.video.TzVideoAdManager
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.login.LoginApi
import com.mints.goodmoney.login.OnLoginListener
......@@ -188,9 +187,7 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
submitInvitedCode()
}
R.id.item_cleanCache -> {
// clearDialog()
TzVideoAdManager.getInstance(this)?.loadAd(this,10,"A","0")
clearDialog()
}
R.id.item_userAgree -> {
val bundle = Bundle()
......
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