Commit 51690ed9 authored by mengcuiguang's avatar mengcuiguang

添加视频详情页广告开关

parent 95812cdb
......@@ -26,6 +26,7 @@ public class AppConfig {
public static boolean enterAlipay = false;
public static boolean showVipVedio = false;
public static boolean showVipAdDialog = false;
public static boolean showVedioPageAdFlag = false;
public static String detailDialogUnlockText = "";
public static long splashTime = 0L;
......
......@@ -3,6 +3,7 @@ package com.changzhi.yipinplaylet.mvp.presenters
import com.google.gson.JsonObject
import com.changzhi.library.net.neterror.BaseSubscriber
import com.changzhi.library.net.neterror.Throwable
import com.changzhi.yipinplaylet.common.AppConfig
import com.changzhi.yipinplaylet.manager.AppHttpManager
import com.changzhi.yipinplaylet.mvp.model.BaseResponse
import com.changzhi.yipinplaylet.mvp.model.IndexList
......@@ -203,24 +204,28 @@ class VideoPresenter : BasePresenter<VideoView>() {
}
fun showTurn() {
fun showVedioConfs() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.showTurn(),
object : BaseSubscriber<BaseResponse<NineShowBean>>() {
.call(loanService.showVedioConfs(),
object : BaseSubscriber<BaseResponse<JsonObject>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<NineShowBean>) {
override fun onNext(baseResponse: BaseResponse<JsonObject>) {
if (isLinkView) return
view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> view.showTurnSuc(baseResponse.data)
200 -> {
try {
AppConfig.showVedioPageAdFlag =
baseResponse.data.get("open_unlockByad").asBoolean
} catch (e: Exception) {
e.printStackTrace()
}
}
else -> {
view.showToast(message)
}
......@@ -229,11 +234,8 @@ class VideoPresenter : BasePresenter<VideoView>() {
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
}
})
}
}
\ No newline at end of file
......@@ -337,6 +337,12 @@ public interface LoanService {
@POST("api/vedioV1/reportOpenAdEcpm")
Observable<BaseResponse<Object>> cmtEcpm(@Body Map<String, Object> vo);
/**
* 视频页广告开关
*/
@POST("api/vedioV1/confs")
Observable<BaseResponse<JsonObject>> showVedioConfs();
/**
* 默认http工厂
......
......@@ -62,7 +62,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
initView()
videoPresenter.getVipProducts()
videoPresenter.showVedioConfs()
}
override fun getBundleExtras(extras: Bundle?) {
......@@ -93,6 +93,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
}
// vip界面返回弹出广告弹窗
if (AppConfig.showVedioPageAdFlag) {
if (AppConfig.showVipAdDialog && !UserManager.getInstance().vipFlag) {
Handler(Looper.getMainLooper()).postDelayed({
adDialog()
......@@ -100,6 +101,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
}, 300)
}
}
}
override fun onPause() {
super.onPause()
......
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